]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
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)
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>

No differences found