builtin/mv: fix out of bounds write
[gitweb.git] / builtin / gc.c
index dd910fbc374a067046670448815aaf790e1d629b..25f2237c08f3b8fbc8f3554f3e22bf7e59e74b1c 100644 (file)
@@ -222,7 +222,7 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
                        time(NULL) - st.st_mtime <= 12 * 3600 &&
                        fscanf(fp, "%"PRIuMAX" %127c", &pid, locking_host) == 2 &&
                        /* be gentle to concurrent "gc" on remote hosts */
-                       (strcmp(locking_host, my_host) || !kill(pid, 0));
+                       (strcmp(locking_host, my_host) || !kill(pid, 0) || errno == EPERM);
                if (fp != NULL)
                        fclose(fp);
                if (should_exit) {
@@ -260,8 +260,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                { OPTION_STRING, 0, "prune", &prune_expire, N_("date"),
                        N_("prune unreferenced objects"),
                        PARSE_OPT_OPTARG, NULL, (intptr_t)prune_expire },
-               OPT_BOOLEAN(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
-               OPT_BOOLEAN(0, "auto", &auto_gc, N_("enable auto-gc mode")),
+               OPT_BOOL(0, "aggressive", &aggressive, N_("be more thorough (increased runtime)")),
+               OPT_BOOL(0, "auto", &auto_gc, N_("enable auto-gc mode")),
                OPT_BOOL(0, "force", &force, N_("force running gc even if there may be another gc running")),
                OPT_END()
        };