]> git.decadent.org.uk Git - nfs-utils.git/commit
libnsm.a: Factor atomic write code out of nsm_get_state()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 14 Jan 2010 17:23:53 +0000 (12:23 -0500)
committerSteve Dickson <steved@redhat.com>
Fri, 15 Jan 2010 19:55:51 +0000 (14:55 -0500)
commitb148d3414a8d574ff7883ad99d3d1dd980a12603
tree37270a5091ae25524a6494aeb1b3bce1df94b584
parentd56192a1e4ddb962f961721b1c5d094696b2d206
libnsm.a: Factor atomic write code out of nsm_get_state()

We're about to use the same logic (mktemp, write, rename) for
other new purposes, so pull it out into its own function.

This change also addresses a latent bug: O_TRUNC is now used when
creating the temporary file.  This eliminates the possibility of
getting stale data in the temp file, if somehow a previous "atomic
write" was interrupted and didn't remove the temporary file.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
support/nsm/file.c