summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-10 16:09:52 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-10 21:23:14 +0100
commit0192cbdb2c19ed2abbf6662090f45ab3bf4caf56 (patch)
tree97abcf845575b1b5a0b47a8935bb8b713ffab6f0 /src/test
parent8e44f5710b1e7d843d224f5344e31383b685dbbf (diff)
downloadsystemd-0192cbdb2c19ed2abbf6662090f45ab3bf4caf56.tar.gz
Revert "nss: prevent PROTECT_ERRNO from squashing changes to *errnop"
This reverts commit b26c90411343d74b15deb24bd87077848e316dab. 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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-fs-util.c6
-rw-r--r--src/test/test-util.c67
2 files changed, 3 insertions, 70 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
index e049abc4a4..b3a4b1749c 100644
--- a/src/test/test-fs-util.c
+++ b/src/test/test-fs-util.c
@@ -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);
}
}
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 95eebde6b0..3c1b5f9b41 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -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();