From 41e612d3da49320a26ee9cad412d0f9d779bb11c Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Wed, 21 Nov 2012 16:29:30 +0400
Subject: [PATCH] Produce a more verbose output in cases when getpwnam() fails.

---
 src/tarantool.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/tarantool.m b/src/tarantool.m
index 91bc92cf0a..e04d82251f 100644
--- a/src/tarantool.m
+++ b/src/tarantool.m
@@ -775,8 +775,15 @@ main(int argc, char **argv)
 	if (cfg.username != NULL) {
 		if (getuid() == 0 || geteuid() == 0) {
 			struct passwd *pw;
+			errno = 0;
 			if ((pw = getpwnam(cfg.username)) == 0) {
-				say_syserror("getpwnam: %s", cfg.username);
+				if (errno) {
+					say_syserror("getpwnam: %s",
+						     cfg.username);
+				} else {
+					say_error("User not found: %s",
+						  cfg.username);
+				}
 				exit(EX_NOUSER);
 			}
 			if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0 || seteuid(pw->pw_uid)) {
-- 
GitLab