Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144436436
D44577.id136402.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
D44577.id136402.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
@@ -506,9 +506,13 @@
* umask blocks owner writes, we fail.
*/
if (dne) {
- if (mkdir(to.p_path,
- curr->fts_statp->st_mode | S_IRWXU) < 0)
- err(1, "%s", to.p_path);
+ mode = curr->fts_statp->st_mode | S_IRWXU;
+ if (mkdir(to.p_path, mode) != 0) {
+ warn("%s", to.p_path);
+ (void)fts_set(ftsp, curr, FTS_SKIP);
+ badcp = rval = 1;
+ break;
+ }
/*
* First DNE with a NULL root_stat is the root
* path, so set root_stat. We can't really
@@ -517,14 +521,19 @@
* first directory we created and use that.
*/
if (root_stat == NULL &&
- stat(to.p_path, &created_root_stat) == -1) {
- err(1, "stat");
- } else if (root_stat == NULL) {
- root_stat = &created_root_stat;
+ stat(to.p_path, &created_root_stat) != 0) {
+ warn("%s", to.p_path);
+ (void)fts_set(ftsp, curr, FTS_SKIP);
+ badcp = rval = 1;
+ break;
}
+ if (root_stat == NULL)
+ root_stat = &created_root_stat;
} else if (!S_ISDIR(to_stat.st_mode)) {
- errno = ENOTDIR;
- err(1, "%s", to.p_path);
+ warnc(ENOTDIR, "%s", to.p_path);
+ (void)fts_set(ftsp, curr, FTS_SKIP);
+ badcp = rval = 1;
+ break;
}
/*
* Arrange to correct directory attributes later
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 9, 10:39 AM (16 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28492392
Default Alt Text
D44577.id136402.diff (1 KB)
Attached To
Mode
D44577: cp: Improved conformance when copying directories.
Attached
Detach File
Event Timeline
Log In to Comment