Skip to content

Commit 14431c7

Browse files
committed
Merge branch 'aw/gc-lockfile-fscanf-fix' into maint
"git gc" tries to avoid running two instances at the same time by reading and writing pid/host from and to a lock file; it used to use an incorrect fscanf() format when reading, which has been corrected. * aw/gc-lockfile-fscanf-fix: gc: call fscanf() with %<len>s, not %<len>c, when reading hostname
2 parents 0f21375 + afe2fab commit 14431c7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builtin/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
257257
int should_exit;
258258

259259
if (!scan_fmt)
260-
scan_fmt = xstrfmt("%s %%%dc", "%"SCNuMAX, HOST_NAME_MAX);
260+
scan_fmt = xstrfmt("%s %%%ds", "%"SCNuMAX, HOST_NAME_MAX);
261261
fp = fopen(pidfile_path, "r");
262262
memset(locking_host, 0, sizeof(locking_host));
263263
should_exit =

0 commit comments

Comments
 (0)