From: Ed Maste Date: Tue, 20 Nov 2012 16:29:09 +0000 (-0500) Subject: Be explicit about missing user. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=04947c6434c94992f20ce6d5dfb282b42e4841c9;p=people%2Fms%2Fdma.git Be explicit about missing user. Previously the error message for a missing 'mail' user was dma: cannot drop root privileges: No error: 0 --- diff --git a/dma.c b/dma.c index bb5fa19..0a2f935 100644 --- a/dma.c +++ b/dma.c @@ -423,9 +423,14 @@ main(int argc, char **argv) if (geteuid() == 0 || getuid() == 0) { struct passwd *pw; + errno = 0; pw = getpwnam(DMA_ROOT_USER); - if (pw == NULL) - err(1, "cannot drop root privileges"); + if (pw == NULL) { + if (errno == 0) + errx(1, "user '%s' not found", DMA_ROOT_USER); + else + err(1, "cannot drop root privileges"); + } if (setuid(pw->pw_uid) != 0) err(1, "cannot drop root privileges");