chiark / gitweb /
locking.c: Refactor the main locking flow.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Apr 2016 22:30:30 +0000 (23:30 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 29 Apr 2016 00:16:23 +0000 (01:16 +0100)
  * 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.


No differences found