summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <habets@google.com>2017-06-20 14:54:41 +0100
committerThomas Habets <habets@google.com>2017-06-20 14:54:41 +0100
commit5fac3f24f014e24fd05b4da0471aa953f70fec6d (patch)
treee8e731d9d613181d14d8fcc4fe3d8b5de85bdbce
parentb1b5d48a4ffe021e078d1d6d140d7ab2f0ddcfbb (diff)
downloadarping-5fac3f24f014e24fd05b4da0471aa953f70fec6d.tar.gz
Better error message for dropping privs to unknown user
-rw-r--r--src/arping.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/arping.c b/src/arping.c
index 26c568a..789aed7 100644
--- a/src/arping.c
+++ b/src/arping.c
@@ -318,9 +318,13 @@ drop_privileges(const char* drop_group)
gid_t gid = 0;
if (!(pw = getpwnam(drop_user))) {
if (verbose) {
- // TODO: better error message.
- printf("arping: getpwnam(%s): %s\n",
- drop_user, strerror(errno));
+ if (errno != 0) {
+ printf("arping: getpwnam(%s): %s\n",
+ drop_user, strerror(errno));
+ } else {
+ printf("arping: getpwnam(%s): unknown user\n",
+ drop_user);
+ }
}
return; // TODO: remove this 'return'.
} else {