Skip to content

Commit cc4d46b

Browse files
weakcameldscho
authored andcommitted
Correct fscanf formatting string for I64u values
Signed-off-by: Waldek Maleska <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2c196db commit cc4d46b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
227227
* running.
228228
*/
229229
time(NULL) - st.st_mtime <= 12 * 3600 &&
230-
fscanf(fp, "%"PRIuMAX" %127c", &pid, locking_host) == 2 &&
230+
fscanf(fp, "%"SCNuMAX" %127c", &pid, locking_host) == 2 &&
231231
/* be gentle to concurrent "gc" on remote hosts */
232232
(strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
233233
if (fp != NULL)

git-compat-util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ extern char *gitbasename(char *);
296296
#define PRIuMAX "llu"
297297
#endif
298298

299+
#ifndef SCNuMAX
300+
#define SCNuMAX PRIuMAX
301+
#endif
302+
299303
#ifndef PRIu32
300304
#define PRIu32 "u"
301305
#endif

0 commit comments

Comments
 (0)