Revert "nss: prevent PROTECT_ERRNO from squashing changes to *errnop"

This reverts commit b26c904113.

I don't see anythign wrong, but Ubuntu autopkgtest CI started failing fairly
consistently since this was merged. Let's see if reverting fixes things.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-01-10 21:23:14 +01:00
parent 8e44f5710b
commit 0192cbdb2c
7 changed files with 44 additions and 133 deletions
+3 -3
View File
@@ -361,11 +361,11 @@ static void test_unlink_noerrno(void) {
{
PROTECT_ERRNO;
errno = 42;
errno = -42;
assert_se(unlink_noerrno(name) >= 0);
assert_se(errno == 42);
assert_se(errno == -42);
assert_se(unlink_noerrno(name) < 0);
assert_se(errno == 42);
assert_se(errno == -42);
}
}
-67
View File
@@ -213,70 +213,6 @@ static void test_protect_errno(void) {
assert_se(errno == 12);
}
static void test_protect_errno_disarmed(void) {
log_info("/* %s */", __func__);
errno = 12;
/**
* Simulate dynamically-linked glibc calling the NSS module with errnop
* and &errno being the same.
*/
int *errnop = &errno;
{
PROTECT_ERRNO;
*errnop = DISARM_PROTECT_ERRNO(25);
}
assert_se(errno == 25);
assert_se(*errnop == 25);
}
static void test_protect_errno_disarmed_inner(void) {
log_info("/* %s */", __func__);
errno = 12;
int *errnop = &errno;
{
PROTECT_ERRNO;
int *_saved_errno_p = &_saved_errno_;
*errnop = DISARM_PROTECT_ERRNO_INNER(25);
}
assert_se(errno == 25);
assert_se(*errnop == 25);
}
static void test_protect_errno_disarmed_static(void) {
log_info("/* %s */", __func__);
errno = 12;
/*
* "In statically linked programs, the main application and NSS
* modules do not share the same thread-local variable errno,
* which is the reason why there is an explicit errnop function
* argument."
*/
int errno2 = 15;
int *errnop = &errno2;
{
PROTECT_ERRNO;
errno = 13;
*errnop = DISARM_PROTECT_ERRNO(25);
assert_se(errno == 12);
errno = 14;
}
assert_se(errno == 14);
assert_se(*errnop == 25);
}
static void test_in_set(void) {
log_info("/* %s */", __func__);
@@ -447,9 +383,6 @@ int main(int argc, char *argv[]) {
test_div_round_up();
test_u64log2();
test_protect_errno();
test_protect_errno_disarmed();
test_protect_errno_disarmed_inner();
test_protect_errno_disarmed_static();
test_in_set();
test_log2i();
test_eqzero();