diff options
author | Sam Morris <sam@robots.org.uk> | 2019-01-09 11:15:53 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-01-10 11:08:42 +0100 |
commit | b26c90411343d74b15deb24bd87077848e316dab (patch) | |
tree | 4379707a38479aae6e472b146692c18ed470dd97 /src/nss-systemd | |
parent | Merge pull request #11376 from yuwata/11365-v2 (diff) | |
download | systemd-b26c90411343d74b15deb24bd87077848e316dab.tar.xz systemd-b26c90411343d74b15deb24bd87077848e316dab.zip |
nss: prevent PROTECT_ERRNO from squashing changes to *errnop
glibc passes in &errno for errnop, which means PROTECT_ERRNO ends up
squashing our intentional changes to *errnop.
Fixes #11321.
Diffstat (limited to 'src/nss-systemd')
-rw-r--r-- | src/nss-systemd/nss-systemd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c index f554828d49..96e6c42ff7 100644 --- a/src/nss-systemd/nss-systemd.c +++ b/src/nss-systemd/nss-systemd.c @@ -210,7 +210,7 @@ enum nss_status _nss_systemd_getpwnam_r( l = strlen(name); if (buflen < l+1) { - *errnop = ERANGE; + *errnop = DISARM_PROTECT_ERRNO(ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -227,7 +227,7 @@ enum nss_status _nss_systemd_getpwnam_r( return NSS_STATUS_SUCCESS; fail: - *errnop = -r; + *errnop = DISARM_PROTECT_ERRNO(r); return NSS_STATUS_UNAVAIL; } @@ -310,7 +310,7 @@ enum nss_status _nss_systemd_getpwuid_r( l = strlen(translated) + 1; if (buflen < l) { - *errnop = ERANGE; + *errnop = DISARM_PROTECT_ERRNO(ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -327,7 +327,7 @@ enum nss_status _nss_systemd_getpwuid_r( return NSS_STATUS_SUCCESS; fail: - *errnop = -r; + *errnop = DISARM_PROTECT_ERRNO(r); return NSS_STATUS_UNAVAIL; } @@ -408,7 +408,7 @@ enum nss_status _nss_systemd_getgrnam_r( l = sizeof(char*) + strlen(name) + 1; if (buflen < l) { - *errnop = ERANGE; + *errnop = DISARM_PROTECT_ERRNO(ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -423,7 +423,7 @@ enum nss_status _nss_systemd_getgrnam_r( return NSS_STATUS_SUCCESS; fail: - *errnop = -r; + *errnop = DISARM_PROTECT_ERRNO(r); return NSS_STATUS_UNAVAIL; } @@ -506,7 +506,7 @@ enum nss_status _nss_systemd_getgrgid_r( l = sizeof(char*) + strlen(translated) + 1; if (buflen < l) { - *errnop = ERANGE; + *errnop = DISARM_PROTECT_ERRNO(ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -521,7 +521,7 @@ enum nss_status _nss_systemd_getgrgid_r( return NSS_STATUS_SUCCESS; fail: - *errnop = -r; + *errnop = DISARM_PROTECT_ERRNO(r); return NSS_STATUS_UNAVAIL; } |