Previously -d/-t was no-op due to wrong handling of args passed to
utimes(2).
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
}
do {
- if (utimes(*argv, reference_file ? timebuf : NULL) != 0) {
+ if (utimes(*argv, (reference_file || date_str) ? timebuf : NULL) != 0) {
if (errno == ENOENT) { /* no such file */
if (opts) { /* creation is disabled, so ignore */
continue;
fd = open(*argv, O_RDWR | O_CREAT, 0666);
if (fd >= 0) {
xclose(fd);
- if (reference_file)
+ if (reference_file || date_str)
utimes(*argv, timebuf);
continue;
}