aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-14 22:16:57 +0000
commit3c163822d88105450806fdb6a29fdfc2511267d1 (patch)
tree4c67645bbc6677ad2217da3cdf6c0a748e0ca88d /utility.c
parent2c1030177e0a6f849ba557400e3e4867de455ce9 (diff)
downloadbusybox-3c163822d88105450806fdb6a29fdfc2511267d1.tar.gz
Fixed cp -[aR] and some other stuf.
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/utility.c b/utility.c
index b2228f0cb..cf90f37d1 100644
--- a/utility.c
+++ b/utility.c
@@ -58,9 +58,8 @@ int isDirectory(const char *name)
* be set.)
*/
int
-copyFile(
- const char *srcName,
- const char *destName, int setModes, int followLinks)
+copyFile( const char *srcName, const char *destName,
+ int setModes, int followLinks)
{
int rfd;
int wfd;
@@ -75,7 +74,6 @@ copyFile(
result = stat(srcName, &srcStatBuf);
else
result = lstat(srcName, &srcStatBuf);
-
if (result < 0) {
perror(srcName);
return FALSE;
@@ -115,7 +113,8 @@ copyFile(
return (FALSE);
}
link_val[link_size] = '\0';
- if (symlink(link_val, destName)) {
+ link_size = symlink(link_val, destName);
+ if (link_size != 0) {
perror(destName);
return (FALSE);
}
@@ -179,7 +178,6 @@ copyFile(
error_exit:
- //fprintf(stderr, "choking on %s\n", destName);
perror(destName);
close(rfd);
close(wfd);
@@ -476,10 +474,11 @@ recursiveAction(const char *fileName, int recurse, int followLinks,
struct stat statbuf;
struct dirent *next;
- if (followLinks)
- status = lstat(fileName, &statbuf);
- else
+ if (followLinks == FALSE)
status = stat(fileName, &statbuf);
+ else
+ status = lstat(fileName, &statbuf);
+
if (status < 0) {
perror(fileName);
return (FALSE);
@@ -487,16 +486,11 @@ recursiveAction(const char *fileName, int recurse, int followLinks,
if (recurse == FALSE) {
if (S_ISDIR(statbuf.st_mode)) {
- if (dirAction == NULL)
- return (TRUE);
- else
+ if (dirAction != NULL)
return (dirAction(fileName));
- } else {
- if (fileAction == NULL)
- return (TRUE);
else
- return (fileAction(fileName));
- }
+ return (TRUE);
+ }
}
if (S_ISDIR(statbuf.st_mode)) {