]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: stop using dup() needlessly 12186/head
authorLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 10:44:15 +0000 (12:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 10:45:46 +0000 (12:45 +0200)
src/login/test-inhibit.c

index a891b0af6fbbb2e4c4f8fd8450e982ffcbe0b66b..7f9013bf9324943b387b78d3b10423c964833e6d 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 
 #include <unistd.h>
+#include <fcntl.h>
 
 #include "sd-bus.h"
 
@@ -30,7 +31,7 @@ static int inhibit(sd_bus *bus, const char *what) {
         assert_se(r >= 0);
         assert_se(fd >= 0);
 
-        return dup(fd);
+        return fcntl(fd, F_DUPFD_CLOEXEC, 3);
 }
 
 static void print_inhibitors(sd_bus *bus) {