From: Matthew Hughes Date: Fri, 2 May 2025 10:44:27 +0000 (+0100) Subject: newgidmap: better error logging on failure X-Git-Tag: 4.18.0-rc1~96 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea109a3e4bcdde47b40951991046011735d6970f;p=thirdparty%2Fshadow.git newgidmap: better error logging on failure Much like the previous commit, similarly relies on `sub_gid_open` preserving `errno`. --- diff --git a/src/newgidmap.c b/src/newgidmap.c index b1bf80e2c..863c5fb66 100644 --- a/src/newgidmap.c +++ b/src/newgidmap.c @@ -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; }