struct timespec timespec[2];
struct timespec const *t;
- if (! no_create)
+ if (STREQ (file, "-"))
+ fd = STDOUT_FILENO;
+ else if (! no_create)
{
/* Try to open FILE, creating it if necessary. */
fd = fd_reopen (STDIN_FILENO, file,
error (0, errno, _("failed to get attributes of %s"),
quote (file));
}
- if (fd != -1)
+ if (fd == STDIN_FILENO)
close (fd);
return false;
}
}
ok = (futimens (fd, file, t) == 0);
- if (fd != -1)
+ if (fd == STDIN_FILENO)
ok &= (close (fd) == 0);
if (!ok)
fputs (_("\
\n\
Note that the -d and -t options accept different time-date formats.\n\
+\n\
+If a FILE is -, touch standard output.\n\
"), stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}