Commit bde119e7 by Peter Pettersson

util: sudo_uid_lookup should always return error if out isn't set

parent 3889ea5e
...@@ -1938,12 +1938,13 @@ static int sudo_uid_lookup(uid_t *out) ...@@ -1938,12 +1938,13 @@ static int sudo_uid_lookup(uid_t *out)
{ {
git_str uid_str = GIT_STR_INIT; git_str uid_str = GIT_STR_INIT;
int64_t uid; int64_t uid;
int error; int error = -1;
if ((error = git__getenv(&uid_str, "SUDO_UID")) == 0 && if (git__getenv(&uid_str, "SUDO_UID") == 0 &&
(error = git__strntol64(&uid, uid_str.ptr, uid_str.size, NULL, 10)) == 0 && git__strntol64(&uid, uid_str.ptr, uid_str.size, NULL, 10) == 0 &&
uid == (int64_t)((uid_t)uid)) { uid == (int64_t)((uid_t)uid)) {
*out = (uid_t)uid; *out = (uid_t)uid;
error = 0;
} }
git_str_dispose(&uid_str); git_str_dispose(&uid_str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment