From 9cd602de068e9db2d4d090c0e289a699237c2b6e Mon Sep 17 00:00:00 2001 From: James Phillips Date: Fri, 26 Jan 2018 07:55:43 -0800 Subject: [PATCH] Improves user lookup error message. Closes #3188 Closes #3184 --- agent/util.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/agent/util.go b/agent/util.go index 0ab2fb6f24..76670a7048 100644 --- a/agent/util.go +++ b/agent/util.go @@ -61,12 +61,11 @@ func setFilePermissions(path string, user, group, mode string) error { } // Try looking up the user by name - if u, err := osuser.Lookup(user); err == nil { - uid, _ = strconv.Atoi(u.Uid) - goto GROUP + u, err := osuser.Lookup(user) + if err != nil { + return fmt.Errorf("failed to look up user %s: %v", user, err) } - - return fmt.Errorf("invalid user specified: %v", user) + uid, _ = strconv.Atoi(u.Uid) } GROUP: