diff options
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r-- | chmod_chown_chgrp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index e9704fff8..c9ea39bf5 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -31,7 +31,7 @@ static uid_t uid=-1; | |||
31 | static gid_t gid=-1; | 31 | static gid_t gid=-1; |
32 | static int whichApp; | 32 | static int whichApp; |
33 | static char* invocationName=NULL; | 33 | static char* invocationName=NULL; |
34 | static mode_t mode=0644; | 34 | static char* theMode=NULL; |
35 | 35 | ||
36 | 36 | ||
37 | #define CHGRP_APP 1 | 37 | #define CHGRP_APP 1 |
@@ -61,7 +61,12 @@ static int fileAction(const char *fileName, struct stat* statbuf) | |||
61 | } | 61 | } |
62 | break; | 62 | break; |
63 | case CHMOD_APP: | 63 | case CHMOD_APP: |
64 | if (chmod(fileName, mode) == 0) | 64 | /* Parse the specified modes */ |
65 | if ( parse_mode(theMode, &(statbuf->st_mode)) == FALSE ) { | ||
66 | fprintf(stderr, "%s: Unknown mode: %s\n", invocationName, theMode); | ||
67 | exit( FALSE); | ||
68 | } | ||
69 | if (chmod(fileName, statbuf->st_mode) == 0) | ||
65 | return( TRUE); | 70 | return( TRUE); |
66 | break; | 71 | break; |
67 | } | 72 | } |
@@ -100,12 +105,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
100 | } | 105 | } |
101 | 106 | ||
102 | if ( whichApp == CHMOD_APP ) { | 107 | if ( whichApp == CHMOD_APP ) { |
103 | /* Find the specified modes */ | 108 | theMode=*argv; |
104 | mode = 0; | ||
105 | if ( parse_mode(*argv, &mode) == FALSE ) { | ||
106 | fprintf(stderr, "%s: Unknown mode: %s\n", invocationName, *argv); | ||
107 | exit( FALSE); | ||
108 | } | ||
109 | } else { | 109 | } else { |
110 | 110 | ||
111 | /* Find the selected group */ | 111 | /* Find the selected group */ |