Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163264873
D55117.id.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.id.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
Wed, Jul 22, 2:05 PM (15 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35218026
Default Alt Text
D55117.id.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