Doh. I never allocated storate for the struct stat I am using.

There was just a never initialized pointer.
 -Erik
This commit is contained in:
Eric Andersen 2001-04-26 18:43:36 +00:00
parent 468f504fd7
commit ca85cdbe4c
2 changed files with 6 additions and 6 deletions

View File

@ -30,12 +30,12 @@
#include "busybox.h" #include "busybox.h"
struct stat *theMode; struct stat theMode;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk) static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{ {
if (chmod(fileName, theMode->st_mode) == 0) if (chmod(fileName, theMode.st_mode) == 0)
return (TRUE); return (TRUE);
perror(fileName); perror(fileName);
return (FALSE); return (FALSE);
@ -59,7 +59,7 @@ int chmod_main(int argc, char **argv)
if (argc > optind && argc > 2 && argv[optind]) { if (argc > optind && argc > 2 && argv[optind]) {
/* Parse the specified mode */ /* Parse the specified mode */
if (parse_mode(argv[optind], &(theMode->st_mode)) == FALSE) { if (parse_mode(argv[optind], &(theMode.st_mode)) == FALSE) {
error_msg_and_die( "unknown mode: %s", argv[optind]); error_msg_and_die( "unknown mode: %s", argv[optind]);
} }
} else { } else {

View File

@ -30,12 +30,12 @@
#include "busybox.h" #include "busybox.h"
struct stat *theMode; struct stat theMode;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk) static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{ {
if (chmod(fileName, theMode->st_mode) == 0) if (chmod(fileName, theMode.st_mode) == 0)
return (TRUE); return (TRUE);
perror(fileName); perror(fileName);
return (FALSE); return (FALSE);
@ -59,7 +59,7 @@ int chmod_main(int argc, char **argv)
if (argc > optind && argc > 2 && argv[optind]) { if (argc > optind && argc > 2 && argv[optind]) {
/* Parse the specified mode */ /* Parse the specified mode */
if (parse_mode(argv[optind], &(theMode->st_mode)) == FALSE) { if (parse_mode(argv[optind], &(theMode.st_mode)) == FALSE) {
error_msg_and_die( "unknown mode: %s", argv[optind]); error_msg_and_die( "unknown mode: %s", argv[optind]);
} }
} else { } else {