diff options
Diffstat (limited to 'cp.c')
-rw-r--r-- | cp.c | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -43,7 +43,6 @@ static int preserveFlag = FALSE; | |||
43 | static const char *srcName; | 43 | static const char *srcName; |
44 | static const char *destName; | 44 | static const char *destName; |
45 | static int destDirFlag = FALSE; | 45 | static int destDirFlag = FALSE; |
46 | static int destExistsFlag = FALSE; | ||
47 | static int srcDirFlag = FALSE; | 46 | static int srcDirFlag = FALSE; |
48 | 47 | ||
49 | static int fileAction(const char *fileName, struct stat* statbuf) | 48 | static int fileAction(const char *fileName, struct stat* statbuf) |
@@ -71,8 +70,6 @@ static int fileAction(const char *fileName, struct stat* statbuf) | |||
71 | 70 | ||
72 | extern int cp_main(int argc, char **argv) | 71 | extern int cp_main(int argc, char **argv) |
73 | { | 72 | { |
74 | struct stat statBuf; | ||
75 | |||
76 | if (argc < 3) { | 73 | if (argc < 3) { |
77 | usage (cp_usage); | 74 | usage (cp_usage); |
78 | } | 75 | } |
@@ -106,11 +103,7 @@ extern int cp_main(int argc, char **argv) | |||
106 | 103 | ||
107 | 104 | ||
108 | destName = argv[argc - 1]; | 105 | destName = argv[argc - 1]; |
109 | if (stat(destName, &statBuf) >= 0) { | 106 | destDirFlag = isDirectory(destName); |
110 | destExistsFlag = TRUE; | ||
111 | if (S_ISDIR(statBuf.st_mode)) | ||
112 | destDirFlag = TRUE; | ||
113 | } | ||
114 | 107 | ||
115 | if ((argc > 3) && destDirFlag==FALSE) { | 108 | if ((argc > 3) && destDirFlag==FALSE) { |
116 | fprintf(stderr, "%s: not a directory\n", destName); | 109 | fprintf(stderr, "%s: not a directory\n", destName); |