summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-08-09 22:34:49 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-08-09 22:34:49 +0300
commit4a70bc0eb12ac68698f0baab28d3efb0ce42eb8f (patch)
tree9f6aa391f4b5166d68707c924a8bf106d741e3f5 /scripts
parenta3c7fe2fab7da2671fc200041bb9618c29d825b3 (diff)
downloadrpm-4a70bc0eb12ac68698f0baab28d3efb0ce42eb8f.tar.gz
rpm-4a70bc0eb12ac68698f0baab28d3efb0ce42eb8f.tar.bz2
rpm-4a70bc0eb12ac68698f0baab28d3efb0ce42eb8f.zip
Avoid truncating /var/log/rpmpkgs in case of errors (rhbz#232830)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rpm.daily7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/rpm.daily b/scripts/rpm.daily
index a3406436c..8a417a944 100755
--- a/scripts/rpm.daily
+++ b/scripts/rpm.daily
@@ -1,4 +1,9 @@
#!/bin/sh
+tmpfile=`/bin/mktemp rpmpkgs.XXXXXXXXX` || exit 1
/bin/rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \
- | /bin/sort > /var/log/rpmpkgs
+ | /bin/sort > "$tmpfile"
+
+[ -s "$tmpfile" ] || exit 1
+/bin/mv "$tmpfile" /var/log/rpmpkgs
+/bin/chmod 0644 /var/log/rpmpkgs