Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173387590
D50391.id155661.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
550 B
Referenced Files
None
Subscribers
None
D50391.id155661.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
@@ -296,6 +296,11 @@
sep = strchr(to.base, '\0');
sep[0] = '/';
sep[1] = '\0';
+ } else {
+ /*
+ * We will create the destination directory imminently.
+ */
+ to.dir = -1;
}
if ((ftsp = fts_open(argv, fts_options, NULL)) == NULL)
@@ -633,8 +638,9 @@
}
if (errno)
err(1, "fts_read");
- fts_close(ftsp);
- close(to.dir);
+ (void)fts_close(ftsp);
+ if (to.dir != AT_FDCWD && to.dir >= 0)
+ (void)close(to.dir);
free(recpath);
return (rval);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 26, 3:26 PM (1 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39666604
Default Alt Text
D50391.id155661.diff (550 B)
Attached To
Mode
D50391: cp: Avoid closing an invalid file descriptor.
Attached
Detach File
Event Timeline
Log In to Comment