Skip to content

Commit 926e894

Browse files
j6tgitster
authored andcommitted
test-chmtime: Fix exit code on Windows
MinGW's bash does not recognize an exit code -1 as failure. See also 47e3de0 (MinGW: truncate exit()'s argument to lowest 8 bits) and 2488df8 (builtin run_command: do not exit with -1). Exit code 1 is good enough. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent edca415 commit 926e894

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test-chmtime.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ int main(int argc, const char *argv[])
8484
if (stat(argv[i], &sb) < 0) {
8585
fprintf(stderr, "Failed to stat %s: %s\n",
8686
argv[i], strerror(errno));
87-
return -1;
87+
return 1;
8888
}
8989

9090
#ifdef WIN32
9191
if (!(sb.st_mode & S_IWUSR) &&
9292
chmod(argv[i], sb.st_mode | S_IWUSR)) {
9393
fprintf(stderr, "Could not make user-writable %s: %s",
9494
argv[i], strerror(errno));
95-
return -1;
95+
return 1;
9696
}
9797
#endif
9898

@@ -107,13 +107,13 @@ int main(int argc, const char *argv[])
107107
if (utb.modtime != sb.st_mtime && utime(argv[i], &utb) < 0) {
108108
fprintf(stderr, "Failed to modify time on %s: %s\n",
109109
argv[i], strerror(errno));
110-
return -1;
110+
return 1;
111111
}
112112
}
113113

114114
return 0;
115115

116116
usage:
117117
fprintf(stderr, "usage: %s %s\n", argv[0], usage_str);
118-
return -1;
118+
return 1;
119119
}

0 commit comments

Comments
 (0)