X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=test-chmtime.c;h=92713d16da5431e9c8395967ab0e116402dfed67;hb=aa3982890fe7506badfddf6252402a335a4d72b7;hp=d5358cbaac2022483b74366555fc9707a7d8ad97;hpb=77f143bf3e218857ec8e5244d7e862e8e0c1a041;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;