[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Findutils-patches] [PATCH] Rename update database atomically.
From: |
James Youngman |
Subject: |
[Findutils-patches] [PATCH] Rename update database atomically. |
Date: |
Fri, 25 Jan 2008 22:01:22 +0000 |
2008-01-25 James Youngman <address@hidden>
* locate/updatedb.sh: Actually rename the old database to the new
one atomically, instead of just claiming the rename is atomic in a
comment :) This fixes Savannah bug #22057.
---
ChangeLog | 6 ++++++
locate/updatedb.sh | 10 ++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8744400..c453650 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-25 James Youngman <address@hidden>
+
+ * locate/updatedb.sh: Actually rename the old database to the new
+ one atomically, instead of just claiming the rename is atomic in a
+ comment :)
+
2008-01-07 James Youngman <address@hidden>
* xargs/xargs.c: (main): Standardise on "Warning" instead of
diff --git a/locate/updatedb.sh b/locate/updatedb.sh
index dd514b3..9f4e4d9 100644
--- a/locate/updatedb.sh
+++ b/locate/updatedb.sh
@@ -289,9 +289,8 @@ fi
# To avoid breaking locate while this script is running, put the
# results in a temp file, then rename it atomically.
if test -s $LOCATE_DB.n; then
- rm -f $LOCATE_DB
- mv $LOCATE_DB.n $LOCATE_DB
- chmod 644 $LOCATE_DB
+ chmod 644 ${LOCATE_DB}.n
+ mv ${LOCATE_DB}.n $LOCATE_DB
else
echo "updatedb: new database would be empty" >&2
rm -f $LOCATE_DB.n
@@ -359,9 +358,8 @@ rm -f $bigrams $filelist
# To reduce the chances of breaking locate while this script is running,
# put the results in a temp file, then rename it atomically.
if test -s $LOCATE_DB.n; then
- rm -f $LOCATE_DB
- mv $LOCATE_DB.n $LOCATE_DB
- chmod 644 $LOCATE_DB
+ chmod 644 ${LOCATE_DB}.n
+ mv ${LOCATE_DB}.n $LOCATE_DB
else
echo "updatedb: new database would be empty" >&2
rm -f $LOCATE_DB.n
--
1.5.3.8
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Findutils-patches] [PATCH] Rename update database atomically.,
James Youngman <=