diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-10-17 09:43:39 +0400 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-10-17 09:43:39 +0400 |
commit | 9b5871888989b16f94cbba5dd304ac444def3afd (patch) | |
tree | 17187e3f6988830c0e329378e552995d083080ed /chmod_chown_chgrp.c | |
parent | cb6e25655f894c90e4befc4bee0e66794dd6858f (diff) |
Some fixes and such
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r-- | chmod_chown_chgrp.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index 5c2adab78..f3d8ce207 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c @@ -49,20 +49,17 @@ static const char chmod_usage[] = "[-R] MODE[,MODE]... FILE...\n" -static int fileAction(const char *fileName) +static int fileAction(const char *fileName, struct stat* statbuf) { - struct stat statBuf; - if (stat(fileName, &statBuf) < 0) { - switch (whichApp) { - case CHGRP_APP: - case CHOWN_APP: - if (chown(fileName, ((whichApp==CHOWN_APP)? uid: statBuf.st_uid), gid) < 0) - return( TRUE); - case CHMOD_APP: - fprintf(stderr, "%s, %d\n", fileName, mode); - if (chmod(fileName, mode)) - return( TRUE); - } + switch (whichApp) { + case CHGRP_APP: + case CHOWN_APP: + if (chown(fileName, ((whichApp==CHOWN_APP)? uid: statbuf->st_uid), gid) < 0) + return( TRUE); + case CHMOD_APP: + fprintf(stderr, "%s, %d\n", fileName, mode); + if (chmod(fileName, mode)) + return( TRUE); } perror(fileName); return( FALSE); |