summaryrefslogtreecommitdiff
path: root/chmod_chown_chgrp.c
diff options
context:
space:
mode:
authorEric Andersen1999-11-18 00:19:26 +0000
committerEric Andersen1999-11-18 00:19:26 +0000
commitded6259f624c34f3bc221d1b2caee30fbcd729a4 (patch)
treecf1f7e4ffe1e24939dcfbc66d3bf0453081c5dc1 /chmod_chown_chgrp.c
parentd80e851dc05f978dded84b7ac9fcae7066e3ffe0 (diff)
downloadbusybox-ded6259f624c34f3bc221d1b2caee30fbcd729a4.zip
busybox-ded6259f624c34f3bc221d1b2caee30fbcd729a4.tar.gz
Latest and greatest0_36
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r--chmod_chown_chgrp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c
index e9704ff..c9ea39b 100644
--- a/chmod_chown_chgrp.c
+++ b/chmod_chown_chgrp.c
@@ -31,7 +31,7 @@ static uid_t uid=-1;
static gid_t gid=-1;
static int whichApp;
static char* invocationName=NULL;
-static mode_t mode=0644;
+static char* theMode=NULL;
#define CHGRP_APP 1
@@ -61,7 +61,12 @@ static int fileAction(const char *fileName, struct stat* statbuf)
}
break;
case CHMOD_APP:
- if (chmod(fileName, mode) == 0)
+ /* Parse the specified modes */
+ if ( parse_mode(theMode, &(statbuf->st_mode)) == FALSE ) {
+ fprintf(stderr, "%s: Unknown mode: %s\n", invocationName, theMode);
+ exit( FALSE);
+ }
+ if (chmod(fileName, statbuf->st_mode) == 0)
return( TRUE);
break;
}
@@ -100,12 +105,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
}
if ( whichApp == CHMOD_APP ) {
- /* Find the specified modes */
- mode = 0;
- if ( parse_mode(*argv, &mode) == FALSE ) {
- fprintf(stderr, "%s: Unknown mode: %s\n", invocationName, *argv);
- exit( FALSE);
- }
+ theMode=*argv;
} else {
/* Find the selected group */