From: fredrik Date: Sat, 9 Jun 2007 23:32:33 +0000 (+0000) Subject: Make info file updates atomic. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=081b510d96f130024baf6f9c7853a324ebf9932f;p=utils.git Make info file updates atomic. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1067 959494ce-11ee-0310-bf91-de5d638817bd --- 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