summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getpwent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 96aee2e..1753a83 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -379,6 +379,7 @@ getpw(int (*fn)(union key, struct passwd *, char *, size_t, struct passwd **),
free(pwd_storage);
if ((pwd_storage_size << 1) > PWD_STORAGE_MAX) {
pwd_storage = NULL;
+ errno = ERANGE;
return (NULL);
}
pwd_storage_size <<= 1;
@@ -387,6 +388,8 @@ getpw(int (*fn)(union key, struct passwd *, char *, size_t, struct passwd **),
return (NULL);
}
} while (res == NULL && rv == ERANGE);
+ if (res == NULL)
+ errno = rv;
return (res);
}
OpenPOWER on IntegriCloud