summaryrefslogtreecommitdiff
path: root/coreutils/touch.c
diff options
context:
space:
mode:
authorMikhail Gusarov2010-03-21 14:22:47 +0600
committerDenys Vlasenko2010-03-21 13:04:47 +0100
commit927e4bb644ca6a50fd3e802806bbddce42daa1a6 (patch)
tree43039ab0588376d66ac3b31aea0eadc00f84798e /coreutils/touch.c
parent53f72bb3f0bd81b1d3af8939a16ec730c7e750c3 (diff)
downloadbusybox-927e4bb644ca6a50fd3e802806bbddce42daa1a6.zip
busybox-927e4bb644ca6a50fd3e802806bbddce42daa1a6.tar.gz
touch: do not ignore argument of -d/-t option
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>
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r--coreutils/touch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 3f7b265..dceb7c1 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -104,7 +104,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
}
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;
@@ -113,7 +113,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
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;
}