Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Open the lock files close-on-exec
Each exec filter and snapshot compressor a fill runs inherited the slot's
lock descriptor beside the stdout it writes into. An flock lasts until
its last copy closes and nothing waits for a process a filter leaves
behind, so a fill killed before its rename could leave the slot locked,
and served stale or uncached, for as long as such a process lived.
The scan holds its lock across no exec and opens the same way so that
the two stay alike.
Diffstat (limited to 'source/cgit.c')
| -rw-r--r-- | source/cgit.c | 2 |
1 file changed, 1 insertion, 1 deletion
diff --git a/source/cgit.c b/source/cgit.c index f81af79..f5f3138 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -337,7 +337,7 @@ static int generate_cached_repolist(const char *path, const char *cached_rc) FILE *f; strbuf_addf(&locked_rc, "%s.lock", cached_rc); - fd = open(locked_rc.buf, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + fd = open(locked_rc.buf, O_RDWR | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR); if (fd == -1) { err = errno; fprintf(stderr, "[cgit] Unable to open %s: %s (%d)\n", locked_rc.buf, strerror(err), err); |
