Correct fscanf formatting string for I64u values
authorWaldek Maleska <w.maleska@gmail.com>
Mon, 26 Oct 2015 13:15:33 +0000 (14:15 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Oct 2015 20:24:03 +0000 (13:24 -0700)
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 <w.maleska@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
git-compat-util.h
index 005adbebea80a83a8d0dbb1de744cb50bf689de6..9023aee23ce0174553a3e4b9ecf71b7de2c8679b 100644 (file)
@@ -222,7 +222,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
                         * running.
                         */
                        time(NULL) - st.st_mtime <= 12 * 3600 &&
-                       fscanf(fp, "%"PRIuMAX" %127c", &pid, locking_host) == 2 &&
+                       fscanf(fp, "%"SCNuMAX" %127c", &pid, locking_host) == 2 &&
                        /* be gentle to concurrent "gc" on remote hosts */
                        (strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
                if (fp != NULL)
index 6a16e20966cd5b084a4490267a3082258ea6e7bb..33bb76229668f79cd1d4406abbb60d35717f6c84 100644 (file)
@@ -237,6 +237,10 @@ extern char *gitbasename(char *);
 #define PRIuMAX "llu"
 #endif
 
+#ifndef SCNuMAX
+#define SCNuMAX PRIuMAX
+#endif
+
 #ifndef PRIu32
 #define PRIu32 "u"
 #endif