commit 1ba387876f865e0d24535418127a487edecccc09
Author: Nalin Dahyabhai <nalin@dahyabhai.net>
Date: Mon May 19 15:43:17 2014 -0400
Call getpwnam_r() correctly
The getpwnam_r() function returns an error directly, and is not
guaranteed to set errno to the same value. We previously checked errno
rather than the result code directly, so fix that.
diff --git a/src/pam_oddjob_mkhomedir.c b/src/pam_oddjob_mkhomedir.c
index 1a7a27d..8836434 100644
--- a/src/pam_oddjob_mkhomedir.c
+++ b/src/pam_oddjob_mkhomedir.c
@@ -100,13 +100,13 @@ send_pam_oddjob_mkhomedir_request(pam_handle_t *pamh)
pw = NULL;
free(buf);
buf = NULL;
- if (errno == ERANGE) {
+ if (ret == ERANGE) {
bufsize += 4;
} else {
break;
}
}
- } while ((ret != 0) && (errno == ERANGE));
+ } while (ret == ERANGE);
if ((pw != NULL) &&
(stat(pw->pw_dir, &st) == -1) && (errno == ENOENT)) {
/* If we're running with the user's privileges, then