X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=test-chmtime.c;h=92713d16da5431e9c8395967ab0e116402dfed67;hb=48c250a121a425a1860226b6a7061aecfbab5246;hp=d5358cbaac2022483b74366555fc9707a7d8ad97;hpb=459d60084fa463203d0adfc99cbf5d6fcd7edd43;p=git.git diff --git a/test-chmtime.c b/test-chmtime.c index d5358cbaa..92713d16d 100644 --- a/test-chmtime.c +++ b/test-chmtime.c @@ -1,7 +1,7 @@ /* * This program can either change modification time of the given * file(s) or just print it. The program does not change atime nor - * ctime (their values are explicitely preserved). + * ctime (their values are explicitly preserved). * * The mtime can be changed to an absolute value: * @@ -87,6 +87,15 @@ int main(int argc, const char *argv[]) return -1; } +#ifdef WIN32 + if (!(sb.st_mode & S_IWUSR) && + chmod(argv[i], sb.st_mode | S_IWUSR)) { + fprintf(stderr, "Could not make user-writable %s: %s", + argv[i], strerror(errno)); + return -1; + } +#endif + utb.actime = sb.st_atime; utb.modtime = set_eq ? set_time : sb.st_mtime + set_time;