summaryrefslogtreecommitdiff
path: root/chmod_chown_chgrp.c
diff options
context:
space:
mode:
authorEric Andersen1999-10-17 05:43:39 +0000
committerEric Andersen1999-10-17 05:43:39 +0000
commit9b5871888989b16f94cbba5dd304ac444def3afd (patch)
tree17187e3f6988830c0e329378e552995d083080ed /chmod_chown_chgrp.c
parentcb6e25655f894c90e4befc4bee0e66794dd6858f (diff)
downloadbusybox-9b5871888989b16f94cbba5dd304ac444def3afd.zip
busybox-9b5871888989b16f94cbba5dd304ac444def3afd.tar.gz
Some fixes and such
Diffstat (limited to 'chmod_chown_chgrp.c')
-rw-r--r--chmod_chown_chgrp.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c
index 5c2adab..f3d8ce2 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);