Date: Fri, 6 Nov 2015 20:05:54 -0000
---
 scp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/scp.c b/scp.c
index dd92451..9a24490 100644
--- a/scp.c
+++ b/scp.c
@@ -1161,11 +1161,8 @@ get_user_name()
        static const char *user_name = NULL;
 
        if (user_name == NULL) {
-               struct passwd *pwd;
-               if (pwd = getpwuid(getuid()))
-                       user_name = xstrdup(pwd->pw_name);
-               else
-                       user_name = "unknown";
+               struct passwd *pwd = getpwuid(getuid());
+               user_name = pwd ? xstrdup(pwd->pw_name) : "unknown";
        }
 
        return user_name;
-- 
2.4.3

Reply via email to