]> granicus.if.org Git - git/commitdiff
test-chmtime: Fix exit code on Windows
authorJohannes Sixt <j6t@kdbg.org>
Sat, 1 Jun 2013 09:34:20 +0000 (11:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 2 Jun 2013 23:23:35 +0000 (16:23 -0700)
MinGW's bash does not recognize an exit code -1 as failure. See also
47e3de0e (MinGW: truncate exit()'s argument to lowest 8 bits) and 2488df84
(builtin run_command: do not exit with -1). Exit code 1 is good enough.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-chmtime.c

index 02b42badd550a4b775aab084b38a63c2f4f561a9..2e601a80384688cc5b0efe5bf066b86bcbf2798e 100644 (file)
@@ -84,7 +84,7 @@ int main(int argc, const char *argv[])
                if (stat(argv[i], &sb) < 0) {
                        fprintf(stderr, "Failed to stat %s: %s\n",
                                argv[i], strerror(errno));
-                       return -1;
+                       return 1;
                }
 
 #ifdef WIN32
@@ -92,7 +92,7 @@ int main(int argc, const char *argv[])
                                chmod(argv[i], sb.st_mode | S_IWUSR)) {
                        fprintf(stderr, "Could not make user-writable %s: %s",
                                argv[i], strerror(errno));
-                       return -1;
+                       return 1;
                }
 #endif
 
@@ -107,7 +107,7 @@ int main(int argc, const char *argv[])
                if (utb.modtime != sb.st_mtime && utime(argv[i], &utb) < 0) {
                        fprintf(stderr, "Failed to modify time on %s: %s\n",
                                argv[i], strerror(errno));
-                       return -1;
+                       return 1;
                }
        }
 
@@ -115,5 +115,5 @@ int main(int argc, const char *argv[])
 
 usage:
        fprintf(stderr, "usage: %s %s\n", argv[0], usage_str);
-       return -1;
+       return 1;
 }