From: Mark Wooding Date: Sun, 24 Apr 2016 22:30:30 +0000 (+0100) Subject: locking.c: Refactor the main locking flow. X-Git-Tag: 1.4.2~1^2~1 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/misc/commitdiff_plain/b7ec4e9118fa390ec20408390a06f3c51a035155?ds=sidebyside;hp=b7ec4e9118fa390ec20408390a06f3c51a035155 locking.c: Refactor the main locking flow. * Calculate the open(2) flags ahead of time. * Move the open(2) until after we set up the alarm. This means that we might not actually set `fd' at all, if we get delayed and the alarm goes off. * Use a separate static (because setjmp(3)) variable to record the fcntl(2) return code. * Use `goto' and labels for the control flow, rather than having everything in an `else' branch. * Use `switch' to pick the results of fcntl(2) apart. ---