Skip to content

Commit fdcdb77

Browse files
weakcamelgitster
authored andcommitted
Correct fscanf formatting string for I64u values
This fix is probably purely cosmetic because PRIuMAX is likely identical to SCNuMAX. Nevertheless, when using a function of the scanf() family, the correct interpolation to use is the latter, not the former. Signed-off-by: Waldek Maleska <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 56a1a3a commit fdcdb77

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
@@ -237,6 +237,10 @@ extern char *gitbasename(char *);
237237
#define PRIuMAX "llu"
238238
#endif
239239

240+
#ifndef SCNuMAX
241+
#define SCNuMAX PRIuMAX
242+
#endif
243+
240244
#ifndef PRIu32
241245
#define PRIu32 "u"
242246
#endif

0 commit comments

Comments
 (0)