From: Chuck Lever Date: Thu, 14 Jan 2010 17:23:53 +0000 (-0500) Subject: libnsm.a: Factor atomic write code out of nsm_get_state() X-Git-Tag: nfs-utils-1-2-2-rc7~9 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=b148d3414a8d574ff7883ad99d3d1dd980a12603;hp=b148d3414a8d574ff7883ad99d3d1dd980a12603 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 ---