about summary refs log tree commit diff
path: root/ui-tag.h
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2018-06-20 07:29:14 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-27 18:13:03 +0200
commitb31e99887b17f513289fb11227b2484504e85b6c (patch)
treefd4b868e415db4de0577495eabf48e6bf814d408 /ui-tag.h
parentgit: update to v2.18.0 (diff)
downloadcgit-pink-b31e99887b17f513289fb11227b2484504e85b6c.tar.gz
cgit-pink-b31e99887b17f513289fb11227b2484504e85b6c.zip
cache: close race window when unlocking slots
We use POSIX advisory record locks to control access to cache slots, but
these have an unhelpful behaviour in that they are released when any
file descriptor referencing the file is closed by this process.

Mostly this is okay, since we know we won't be opening the lock file
anywhere else, but there is one place that it does matter: when we
restore stdout we dup2() over a file descriptor referring to the file,
thus closing that descriptor.

Since we restore stdout before unlocking the slot, this creates a window
during which the slot content can be overwritten.  The fix is reasonably
straightforward: simply restore stdout after unlocking the slot, but the
diff is a bit bigger because this requires us to move the temporary
stdout FD into struct cache_slot.

Signed-off-by: John Keeping <john@keeping.me.uk>
Reviewed-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-tag.h')
0 files changed, 0 insertions, 0 deletions
gency/2024-07-04/lens?id=33dc5229a56defdf616b72c5e32dab42beb11918&follow=1'>Add the end of the Harman Phoenix rollJune McEnroe 2024-07-08Add photos from July 3, the hikeJune McEnroe 2024-07-07Add photos from July 1June McEnroe 2024-07-07Add photos from June 25-30June McEnroe 2024-06-30Add photos from June 22 (and the few days after that)June McEnroe 2024-06-30Accommodate lower-case .jpg filesJune McEnroe 2024-06-23Add another BACKXWASH showJune McEnroe It was good! 2024-06-16Update bioJune McEnroe 2024-06-15Add photo descriptions from June 12June McEnroe 2024-06-10Add first roll of film from June 8June McEnroe 2024-06-10Cope with not having an EXIF infoJune McEnroe 2024-06-10Resize using target pixel counts for consistencyJune McEnroe This will resize film scans to about the same size as for the digital photos. 2024-06-10Add The Girl Who Was Convinced...June McEnroe Not much there. The illustrations are very nice though. 2024-06-09Add photos from May 31June McEnroe 2024-06-09Use monospace on photo pagesJune McEnroe 2024-06-09Put lens and (future) film at the tops of photo pagesJune McEnroe 2024-05-22Remove use of sysexits.hJune McEnroe 2024-05-22Add photo descriptions from 05-03 and 05-06June McEnroe 2024-05-21Fix = precedence in whenJune McEnroe