diff options
| author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-03-21 14:22:47 +0600 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-03-21 13:04:47 +0100 |
| commit | 927e4bb644ca6a50fd3e802806bbddce42daa1a6 (patch) | |
| tree | 43039ab0588376d66ac3b31aea0eadc00f84798e | |
| parent | 53f72bb3f0bd81b1d3af8939a16ec730c7e750c3 (diff) | |
| download | busybox-w32-927e4bb644ca6a50fd3e802806bbddce42daa1a6.tar.gz busybox-w32-927e4bb644ca6a50fd3e802806bbddce42daa1a6.tar.bz2 busybox-w32-927e4bb644ca6a50fd3e802806bbddce42daa1a6.zip | |
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>
| -rw-r--r-- | coreutils/touch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c index 3f7b265bd..dceb7c1cc 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
| @@ -104,7 +104,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | do { | 106 | do { |
| 107 | if (utimes(*argv, reference_file ? timebuf : NULL) != 0) { | 107 | if (utimes(*argv, (reference_file || date_str) ? timebuf : NULL) != 0) { |
| 108 | if (errno == ENOENT) { /* no such file */ | 108 | if (errno == ENOENT) { /* no such file */ |
| 109 | if (opts) { /* creation is disabled, so ignore */ | 109 | if (opts) { /* creation is disabled, so ignore */ |
| 110 | continue; | 110 | continue; |
| @@ -113,7 +113,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
| 113 | fd = open(*argv, O_RDWR | O_CREAT, 0666); | 113 | fd = open(*argv, O_RDWR | O_CREAT, 0666); |
| 114 | if (fd >= 0) { | 114 | if (fd >= 0) { |
| 115 | xclose(fd); | 115 | xclose(fd); |
| 116 | if (reference_file) | 116 | if (reference_file || date_str) |
| 117 | utimes(*argv, timebuf); | 117 | utimes(*argv, timebuf); |
| 118 | continue; | 118 | continue; |
| 119 | } | 119 | } |
