aboutsummaryrefslogtreecommitdiff
path: root/cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'cp.c')
-rw-r--r--cp.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/cp.c b/cp.c
index 1e10f2868..83460190a 100644
--- a/cp.c
+++ b/cp.c
@@ -43,7 +43,6 @@ static int preserveFlag = FALSE;
43static const char *srcName; 43static const char *srcName;
44static const char *destName; 44static const char *destName;
45static int destDirFlag = FALSE; 45static int destDirFlag = FALSE;
46static int destExistsFlag = FALSE;
47static int srcDirFlag = FALSE; 46static int srcDirFlag = FALSE;
48 47
49static int fileAction(const char *fileName, struct stat* statbuf) 48static int fileAction(const char *fileName, struct stat* statbuf)
@@ -71,8 +70,6 @@ static int fileAction(const char *fileName, struct stat* statbuf)
71 70
72extern int cp_main(int argc, char **argv) 71extern 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);