2014-04-08 15:02:52 +02:00
|
|
|
---
|
2016-12-16 10:45:04 +01:00
|
|
|
src/mandb.c | 12 +++++++++++-
|
|
|
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
2014-04-08 15:02:52 +02:00
|
|
|
|
2012-10-02 19:06:04 +02:00
|
|
|
--- src/mandb.c
|
2018-11-26 12:53:50 +01:00
|
|
|
+++ src/mandb.c 2018-11-23 12:50:40.139688661 +0000
|
|
|
|
@@ -442,18 +442,27 @@ static int mandb (struct dbpaths *dbpath
|
2016-12-16 10:45:04 +01:00
|
|
|
int ret, amount;
|
2012-10-02 19:06:04 +02:00
|
|
|
char *dbname;
|
2016-12-16 10:45:04 +01:00
|
|
|
int should_create;
|
2012-10-02 19:06:04 +02:00
|
|
|
+ int fd;
|
|
|
|
|
|
|
|
dbname = mkdbname (catpath);
|
2014-04-08 15:02:52 +02:00
|
|
|
database = xasprintf ("%s/%d", catpath, getpid ());
|
|
|
|
|
2012-10-02 19:06:04 +02: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);
|
|
|
|
|
2016-12-16 10:45:04 +01:00
|
|
|
if (!STREQ (catpath, manpath)) {
|
|
|
|
char *cachedir_tag;
|
|
|
|
- int fd;
|
2018-11-26 12:53:50 +01:00
|
|
|
int cachedir_tag_exists = 0;
|
2012-10-02 19:06:04 +02:00
|
|
|
|
2016-12-16 10:45:04 +01:00
|
|
|
+ drop_effective_privs ();
|
|
|
|
cachedir_tag = xasprintf ("%s/CACHEDIR.TAG", catpath);
|
|
|
|
fd = open (cachedir_tag, O_RDONLY);
|
|
|
|
if (fd < 0) {
|
2018-11-26 12:53:50 +01:00
|
|
|
@@ -476,6 +485,7 @@ static int mandb (struct dbpaths *dbpath
|
|
|
|
chown_if_possible (cachedir_tag);
|
|
|
|
check_chmod (cachedir_tag, DBMODE);
|
|
|
|
}
|
2016-12-16 10:45:04 +01:00
|
|
|
+ regain_effective_privs ();
|
2015-05-28 15:24:43 +02:00
|
|
|
free (cachedir_tag);
|
2012-10-02 19:06:04 +02:00
|
|
|
}
|
2016-12-16 10:45:04 +01:00
|
|
|
|