aboutsummaryrefslogtreecommitdiff
path: root/coreutils/cp.c
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>1999-10-18 19:02:32 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>1999-10-18 19:02:32 +0000
commitbed30e97005aca748a44806399c646633038daa8 (patch)
treecdba32234f059656b0279b324ae28c742692cd0c /coreutils/cp.c
parent9b5871888989b16f94cbba5dd304ac444def3afd (diff)
downloadbusybox-bed30e97005aca748a44806399c646633038daa8.tar.gz
busybox-bed30e97005aca748a44806399c646633038daa8.tar.bz2
More fixes
Diffstat (limited to 'coreutils/cp.c')
-rw-r--r--coreutils/cp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c
index 4016fc760..c5e34d333 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -48,7 +48,7 @@ static int fileAction(const char *fileName, struct stat* statbuf)
{
char newdestName[NAME_MAX];
strcpy(newdestName, destName);
- if (dirFlag==TRUE && newdestName[strlen(newdestName)-1]!= '/' ) {
+ if (dirFlag==TRUE) {
strcat(newdestName, "/");
if ( skipName != NULL)
strcat(newdestName, strstr(fileName, skipName));
@@ -104,10 +104,12 @@ extern int cp_main(int argc, char **argv)
while (argc-- > 1) {
srcName = *(argv++);
skipName = strrchr(srcName, '/');
- if (skipName) skipName++;
- if (recursiveAction(srcName, recursiveFlag, followLinks,
- fileAction, fileAction) == FALSE)
+ if (skipName)
+ skipName++;
+ if (recursiveAction(srcName, recursiveFlag, followLinks, FALSE,
+ fileAction, fileAction) == FALSE) {
exit( FALSE);
+ }
}
exit( TRUE);
}