Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163600509
D55117.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
646 B
Referenced Files
None
Subscribers
None
D55117.diff
View Options
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -163,19 +163,14 @@
/* Create the file. */
fd = open(*argv,
O_WRONLY | O_CREAT, DEFFILEMODE);
- if (fd == -1) {
+ if (fd < 0 || fstat(fd, &sb) < 0) {
rval = 1;
warn("%s", *argv);
+ if (fd >= 0)
+ (void)close(fd);
continue;
}
- if (fstat(fd, &sb) < 0) {
- warn("%s", *argv);
- rval = 1;
- }
- if (close(fd) < 0) {
- warn("%s", *argv);
- rval = 1;
- }
+ (void)close(fd);
/* If using the current time, we're done. */
if (!timeset)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 25, 8:33 PM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35489725
Default Alt Text
D55117.diff (646 B)
Attached To
Mode
D55117: touch: Fix setting time of created file if fstat() fails
Attached
Detach File
Event Timeline
Log In to Comment