From 081b510d96f130024baf6f9c7853a324ebf9932f Mon Sep 17 00:00:00 2001 From: fredrik Date: Sat, 9 Jun 2007 23:32:33 +0000 Subject: [PATCH] Make info file updates atomic. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1067 959494ce-11ee-0310-bf91-de5d638817bd --- planime | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/planime b/planime index 899a1c9..edcba1f 100755 --- a/planime +++ b/planime @@ -60,10 +60,8 @@ ifile=".${ep}.info" if [ -n "$savepar" ]; then if [ -r "$ifile" ]; then - exec 3<"$ifile" - rm "$ifile" - egrep -v "^${savepar}:" 0<&3 >"$ifile" - exec 3<&- + egrep -v "^${savepar}:" "$ifile" >"$ifile.new" + mv -f "$ifile.new" "$ifile" fi echo "$savepar: $saveval" >>"$ifile" exit 0 -- 2.11.0