From faa52bdcc0221de2d8fae950e409a8ac5e05bfcd Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Wed, 28 Mar 2018 19:46:27 +0200 Subject: Format error messages properly Make use of strerror(errno) and format all errors equally: function ['parameters']: error message --- components/user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'components/user.c') diff --git a/components/user.c b/components/user.c index ffbd945..b335dc3 100644 --- a/components/user.c +++ b/components/user.c @@ -1,6 +1,8 @@ /* See LICENSE file for copyright and license details. */ +#include #include #include +#include #include #include @@ -18,7 +20,7 @@ username(void) struct passwd *pw = getpwuid(geteuid()); if (pw == NULL) { - fprintf(stderr, "Failed to get username"); + fprintf(stderr, "getpwuid '%d': %s\n", geteuid(), strerror(errno)); return NULL; } -- cgit v1.2.3