summaryrefslogtreecommitdiff
path: root/src/nss-myhostname
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-16 21:29:09 +0100
committerMartin Pitt <martinpitt@users.noreply.github.com>2017-02-16 21:29:09 +0100
commitcda458a54a8f5b18af16d4465509d17e4162d455 (patch)
tree9f8207fed604b2a3528666e950e498aaa70969a1 /src/nss-myhostname
parent8acdd72120728cfc1742d7c37ceac8c0ade28ee3 (diff)
nss: fix error to ERANGE for nss calls with too little buffer space (#5365)
This is a follow-up for #5359, fixing the error codes in a similar way for the other NSS modules. (user/group lookup calls don't have h_errnop, hence we don't update that in those cases)
Diffstat (limited to 'src/nss-myhostname')
-rw-r--r--src/nss-myhostname/nss-myhostname.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index 326672cab5..0570fde592 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -114,8 +114,8 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
l = strlen(canonical);
ms = ALIGN(l+1) + ALIGN(sizeof(struct gaih_addrtuple)) * (n_addresses > 0 ? n_addresses : 2);
if (buflen < ms) {
- *errnop = ENOMEM;
- *h_errnop = NO_RECOVERY;
+ *errnop = ERANGE;
+ *h_errnop = NETDB_INTERNAL;
return NSS_STATUS_TRYAGAIN;
}
@@ -220,8 +220,8 @@ static enum nss_status fill_in_hostent(
(c > 0 ? c+1 : 2) * sizeof(char*);
if (buflen < ms) {
- *errnop = ENOMEM;
- *h_errnop = NO_RECOVERY;
+ *errnop = ERANGE;
+ *h_errnop = NETDB_INTERNAL;
return NSS_STATUS_TRYAGAIN;
}