summaryrefslogtreecommitdiff
path: root/src/test/test-sd-hwdb.c
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2020-04-23 13:12:23 +0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-26 20:18:48 +0200
commit3c14dc61f7782d8eca0ff7b55e9f60fef176fe82 (patch)
tree3296fc428ff2b84635404b6702250c11b2232f81 /src/test/test-sd-hwdb.c
parent7b679a188ee2f643e47938e8f287347399f2e083 (diff)
downloadsystemd-3c14dc61f7782d8eca0ff7b55e9f60fef176fe82.tar.gz
tests: various small fixes for strict systems
Don't assume that 4MB can be allocated from stack since there could be smaller DefaultLimitSTACK= in force, so let's use malloc(). NUL terminate the huge strings by hand, also ensure termination in test_lz4_decompress_partial() and optimize the memset() for the string. Some items in /proc and /etc may not be accessible to poor unprivileged users due to e.g. SELinux, BOFH or both, so check for EACCES and EPERM. /var/tmp may be a symlink to /tmp and then path_compare() will always fail, so let's stick to /tmp like elsewhere. /tmp may be mounted with noexec option and then trying to execute scripts from there would fail. Detect and warn if seccomp is already in use, which could make seccomp test fail if the syscalls are already blocked. Unset $TMPDIR so it will not break specifier tests where %T is assumed to be /tmp and %V /var/tmp.
Diffstat (limited to 'src/test/test-sd-hwdb.c')
-rw-r--r--src/test/test-sd-hwdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test-sd-hwdb.c b/src/test/test-sd-hwdb.c
index 17ca6a0e27..eb34d8eab2 100644
--- a/src/test/test-sd-hwdb.c
+++ b/src/test/test-sd-hwdb.c
@@ -1,6 +1,7 @@
#include "sd-hwdb.h"
#include "alloc-util.h"
+#include "errno-util.h"
#include "errno.h"
#include "tests.h"
@@ -12,7 +13,7 @@ static int test_failed_enumerate(void) {
log_info("/* %s */", __func__);
r = sd_hwdb_new(&hwdb);
- if (r == -ENOENT)
+ if (r == -ENOENT || ERRNO_IS_PRIVILEGE(r))
return r;
assert_se(r == 0);