Doh. I never allocated storate for the struct stat I am using.
authorEric Andersen <andersen@codepoet.org>
Thu, 26 Apr 2001 18:43:36 +0000 (18:43 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 26 Apr 2001 18:43:36 +0000 (18:43 -0000)
There was just a never initialized pointer.
 -Erik

chmod.c
coreutils/chmod.c

diff --git a/chmod.c b/chmod.c
index 93b7f78cdb6d81fe868f767070f183f6c0daf8d9..742770e90ac5099be48be57b4335c2d656b79289 100644 (file)
--- a/chmod.c
+++ b/chmod.c
 #include "busybox.h"
 
 
-struct stat *theMode;
+struct stat theMode;
 
 
 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);
        perror(fileName);
        return (FALSE);
@@ -59,7 +59,7 @@ int chmod_main(int argc, char **argv)
 
        if (argc > optind && argc > 2 && argv[optind]) {
                /* 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]);
                }
        } else {
index 93b7f78cdb6d81fe868f767070f183f6c0daf8d9..742770e90ac5099be48be57b4335c2d656b79289 100644 (file)
 #include "busybox.h"
 
 
-struct stat *theMode;
+struct stat theMode;
 
 
 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);
        perror(fileName);
        return (FALSE);
@@ -59,7 +59,7 @@ int chmod_main(int argc, char **argv)
 
        if (argc > optind && argc > 2 && argv[optind]) {
                /* 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]);
                }
        } else {