Make info file updates atomic.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 9 Jun 2007 23:32:33 +0000 (23:32 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 9 Jun 2007 23:32:33 +0000 (23:32 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1067 959494ce-11ee-0310-bf91-de5d638817bd

planime

diff --git a/planime b/planime
index 899a1c9..edcba1f 100755 (executable)
--- 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