Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137310551
D49841.id153696.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D49841.id153696.diff
View Options
diff --git a/bin/cp/cp.c b/bin/cp/cp.c
--- a/bin/cp/cp.c
+++ b/bin/cp/cp.c
@@ -214,7 +214,7 @@
* Case (1). Target is not a directory.
*/
if (argc > 1)
- errx(1, "%s is not a directory", to.p_path);
+ errc(1, ENOTDIR, "%s", to.p_path);
/*
* Need to detect the case:
@@ -237,17 +237,17 @@
type = FILE_TO_FILE;
if (have_trailing_slash && type == FILE_TO_FILE) {
- if (r == -1) {
- errx(1, "directory %s does not exist",
- to.p_path);
- } else
- errx(1, "%s is not a directory", to.p_path);
+ if (r == -1)
+ errc(1, ENOENT, "%s", to.p_path);
+ else
+ errc(1, ENOTDIR, "%s", to.p_path);
}
- } else
+ } else {
/*
* Case (2). Target is a directory.
*/
type = FILE_TO_DIR;
+ }
/*
* For DIR_TO_DNE, we could provide copy() with the to_stat we've
@@ -339,8 +339,8 @@
base = (p == NULL) ? 0 :
(int)(p - curr->fts_path + 1);
- if (!strcmp(&curr->fts_path[base],
- ".."))
+ if (strcmp(curr->fts_path + base, "..")
+ == 0)
base += 1;
} else
base = curr->fts_pathlen;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 23, 8:01 AM (9 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26008866
Default Alt Text
D49841.id153696.diff (1 KB)
Attached To
Mode
D49841: cp: Improve error messages.
Attached
Detach File
Event Timeline
Log In to Comment