]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: make "test-execute" work in "sudo ninja -C build test" (#7463)
authorLennart Poettering <lennart@poettering.net>
Fri, 24 Nov 2017 21:56:44 +0000 (22:56 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 24 Nov 2017 21:56:44 +0000 (22:56 +0100)
In this mode USER/LOGNAME still point to the original caller, and our
tests get confused by that.

Follow-up for: #7450

src/test/test-execute.c

index 14e23a32e92a83b87946881c4b29da911bd6491e..626d3ac8b90cf435c26bd01c8d8a3625854781a5 100644 (file)
@@ -560,6 +560,9 @@ int main(int argc, char *argv[]) {
         log_parse_environment();
         log_open();
 
+        (void) unsetenv("USER");
+        (void) unsetenv("LOGNAME");
+
         /* It is needed otherwise cgroup creation fails */
         if (getuid() != 0) {
                 puts("Skipping test: not root");