]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
newgidmap: better error logging on failure master
authorMatthew Hughes <matthewhughes934@gmail.com>
Fri, 2 May 2025 10:44:27 +0000 (11:44 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Fri, 2 May 2025 13:49:25 +0000 (15:49 +0200)
Much like the previous commit, similarly relies on `sub_gid_open`
preserving `errno`.

src/newgidmap.c

index b1bf80e2c4f09200b67f24d8880373a5fdda90f9..863c5fb662be5f96ea0dc9454047961dcabb0cea 100644 (file)
@@ -190,8 +190,9 @@ int main(int argc, char **argv)
 
        /* Get the effective uid and effective gid of the target process */
        if (fstat(proc_dir_fd, &st) < 0) {
-               fprintf(stderr, _("%s: Could not stat directory for process\n"),
-                       Prog);
+               fprintf(stderr,
+                       _("%s: Could not stat directory for target process: %s\n"),
+                       Prog, strerror (errno));
                return EXIT_FAILURE;
        }
 
@@ -211,6 +212,9 @@ int main(int argc, char **argv)
        }
 
        if (!sub_gid_open(O_RDONLY)) {
+               fprintf (stderr,
+                        _("%s: cannot open %s: %s\n"),
+                        Prog, sub_gid_dbname (), strerror (errno));
                return EXIT_FAILURE;
        }