2006-12-19 00:17:06 +01:00
|
|
|
--- src/mandb.c
|
2008-04-23 01:42:57 +02:00
|
|
|
+++ src/mandb.c 2008-04-21 13:06:01.440910914 +0200
|
|
|
|
@@ -36,6 +36,7 @@
|
2006-12-19 00:17:06 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h> /* for chmod() */
|
|
|
|
+#include <fcntl.h> /* for open () */
|
2007-12-12 18:16:54 +01:00
|
|
|
#include <dirent.h>
|
2008-04-23 01:42:57 +02:00
|
|
|
#include <unistd.h>
|
2006-12-19 00:17:06 +01:00
|
|
|
|
2008-04-23 01:42:57 +02:00
|
|
|
@@ -414,11 +415,20 @@ static short mandb (const char *catpath,
|
2006-12-19 00:17:06 +01:00
|
|
|
char pid[23];
|
|
|
|
short amount;
|
|
|
|
char *dbname;
|
|
|
|
+ int fd;
|
|
|
|
|
|
|
|
dbname = mkdbname (catpath);
|
|
|
|
sprintf (pid, "%d", getpid ());
|
2008-04-23 01:42:57 +02:00
|
|
|
database = appendstr (NULL, catpath, "/", pid, NULL);
|
2006-12-19 00:17:06 +01:00
|
|
|
-
|
|
|
|
+
|
|
|
|
+ /* Just for the case that catpath isn't a system catpath */
|
|
|
|
+ drop_effective_privs ();
|
|
|
|
+ fd = open (database, O_WRONLY | O_CREAT | O_EXCL, 0644);
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
+ if (fd < 0)
|
|
|
|
+ error (FATAL, errno, _("can't create a temporary filename"));
|
|
|
|
+ close(fd);
|
|
|
|
+
|
|
|
|
if (!quiet)
|
|
|
|
printf (_("Processing manual pages under %s...\n"), manpath);
|
|
|
|
#ifdef NDBM
|