Hopefully the following patch provides a remedial solution for those who
still want their updatedb to run as root. Also, I figured this would help
if other software makes use of sort (I was surprised to find updatedb was a
shell script), or an unsuspecting someone may use sort as root every once
in a while. Also, this is quite an amateur investigation, so comments are
welcome.
Sort is in textutils, this applies to textutils 1.22 on ftp.gnu.org. cd
into textutils-1.22/src before applying the patch.
--- sort_orig.c Tue Mar 3 00:26:00 1998
+++ sort.c Tue Mar 3 00:25:32 1998
@@ -321,7 +321,7 @@
FILE *fp;
int fd;
- fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ fd = open (file, O_EXCL | O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)
{
error (0, errno, "%s", file);
--------------------------
Michael A. Ballbach: N0ZTQ
ballbach@lorien.ml.org <--- PGP Key Here. (finger)
mikeb@vr1.com
http://ballbach.lorien.ml.org/
"I don't know how world war three will be fought, but world war four will
be fought with sticks and stones." -- Albert Einstein.