diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cp.c | 2 | ||||
-rw-r--r-- | coreutils/mv.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index 57158c820..ce632016e 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -54,6 +54,8 @@ static int fileAction(const char *fileName, struct stat* statbuf) | |||
54 | strcat(newdestName, "/"); | 54 | strcat(newdestName, "/"); |
55 | if ( skipName != NULL) | 55 | if ( skipName != NULL) |
56 | strcat(newdestName, strstr(fileName, skipName)); | 56 | strcat(newdestName, strstr(fileName, skipName)); |
57 | else | ||
58 | strcat(newdestName, srcName); | ||
57 | } | 59 | } |
58 | return (copyFile(fileName, newdestName, preserveFlag, followLinks)); | 60 | return (copyFile(fileName, newdestName, preserveFlag, followLinks)); |
59 | } | 61 | } |
diff --git a/coreutils/mv.c b/coreutils/mv.c index b861ab7e6..2be3961ca 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -56,7 +56,7 @@ extern int mv_main(int argc, char **argv) | |||
56 | fprintf(stderr, "%s: not a directory\n", destName); | 56 | fprintf(stderr, "%s: not a directory\n", destName); |
57 | exit (FALSE); | 57 | exit (FALSE); |
58 | } | 58 | } |
59 | 59 | ||
60 | while (argc-- > 1) { | 60 | while (argc-- > 1) { |
61 | srcName = *(argv++); | 61 | srcName = *(argv++); |
62 | skipName = strrchr(srcName, '/'); | 62 | skipName = strrchr(srcName, '/'); |
@@ -67,6 +67,11 @@ extern int mv_main(int argc, char **argv) | |||
67 | strcat(newdestName, "/"); | 67 | strcat(newdestName, "/"); |
68 | if ( skipName != NULL) | 68 | if ( skipName != NULL) |
69 | strcat(newdestName, strstr(srcName, skipName)); | 69 | strcat(newdestName, strstr(srcName, skipName)); |
70 | else | ||
71 | strcat(newdestName, srcName); | ||
72 | fprintf(stderr, "srcName='%s'\n", srcName); | ||
73 | fprintf(stderr, "skipName='%s'\n", skipName); | ||
74 | fprintf(stderr, "newdestName='%s'\n", newdestName); | ||
70 | } | 75 | } |
71 | if (copyFile(srcName, newdestName, FALSE, FALSE) == FALSE) { | 76 | if (copyFile(srcName, newdestName, FALSE, FALSE) == FALSE) { |
72 | exit( FALSE); | 77 | exit( FALSE); |