From 208b358a652970a223d5c34f5b776bf080a2037c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 9 Apr 2023 16:10:08 +0100 Subject: mandb: Warn if not running as cache owner Fixes https://gitlab.com/man-db/man-db/-/issues/17. * src/mandb.c (main): If effective user ID doesn't match the configured cache owner (if any), and the `--quiet` option wasn't used, then issue a warning. * NEWS.md: Document this. --- src/mandb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mandb.c') diff --git a/src/mandb.c b/src/mandb.c index e62085ea..07ea923c 100644 --- a/src/mandb.c +++ b/src/mandb.c @@ -896,8 +896,15 @@ int main (int argc, char *argv[]) #ifdef MAN_OWNER man_owner = get_man_owner (); - if (!user && euid != 0 && euid != man_owner->pw_uid) + if (!user && euid != 0 && euid != man_owner->pw_uid) { user = true; + if (!quiet) + fprintf (stderr, + _("Only the '%s' user can create or update " + "system-wide databases; acting as if the " + "--user-db option was used.\n"), + man_owner->pw_name); + } #endif /* MAN_OWNER */ read_config_file (user); -- cgit v1.2.3