Skip to content

Commit b336a3f

Browse files
committed
Merge pull request #60 from weakcamel/fscanf-64bit-constants
Correct fscanf formatting string for I64u values Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents 36bd1d7 + c0d6067 commit b336a3f

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
@@ -222,7 +222,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
222222
* running.
223223
*/
224224
time(NULL) - st.st_mtime <= 12 * 3600 &&
225-
fscanf(fp, "%"PRIuMAX" %127c", &pid, locking_host) == 2 &&
225+
fscanf(fp, "%"SCNuMAX" %127c", &pid, locking_host) == 2 &&
226226
/* be gentle to concurrent "gc" on remote hosts */
227227
(strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
228228
if (fp != NULL)

git-compat-util.h

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

247+
#ifndef SCNuMAX
248+
#define SCNuMAX PRIuMAX
249+
#endif
250+
247251
#ifndef PRIu32
248252
#define PRIu32 "u"
249253
#endif

0 commit comments

Comments
 (0)