Merge #11131: rpc: Write authcookie atomically
commitc7229ac36e366ec4e23e3c131abf3bb3736b7e5d
authorWladimir J. van der Laan <laanwj@gmail.com>
Mon, 28 Aug 2017 07:40:08 +0000 (28 09:40 +0200)
committerWladimir J. van der Laan <laanwj@gmail.com>
Mon, 28 Aug 2017 07:40:15 +0000 (28 09:40 +0200)
treeaa1794d770ee294534ae3550c96c8e8b8c62f4ce
parent5b8af7b8791366906c81eeaf76275470849fb103
parent82dd7195e1fb943f9cd45a48188f9678219c0206
Merge #11131: rpc: Write authcookie atomically

82dd719 rpc: Write authcookie atomically (Wladimir J. van der Laan)

Pull request description:

  Use POSIX rename atomicity at the `bitcoind` side to create a working
  cookie atomically:

  - Write `.cookie.tmp`, close file
  - Rename `.cookie.tmp` to `.cookie`

  This avoids clients reading invalid/partial cookies as in #11129. As such, this is an alternative to that PR.

Tree-SHA512: 47fcc1ed2ff3d8fed4b7441e4939f29cc99b57b7a035673c3b55a124a2e49c8a904637a6ff700dd13a184be8c0255707d74781f8e626314916418954e2467e03