summaryrefslogtreecommitdiffstats
path: root/src/test/test-fd-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-12 00:33:16 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-21 00:49:09 +0100
commit504afd7c34e00eb84589e94e59cd14f2fffa2807 (patch)
treece9cbf783c00d118a1d528bb67a564ab81379696 /src/test/test-fd-util.c
parentbasic/strv: allow NULLs to be inserted into strv (diff)
downloadsystemd-504afd7c34e00eb84589e94e59cd14f2fffa2807.tar.xz
systemd-504afd7c34e00eb84589e94e59cd14f2fffa2807.zip
core/manager: split out creation of serialization fd out to a helper
There is a slight change in behaviour: the user manager for root will create a temporary file in /run/systemd, not /tmp. I don't think this matters, but simplifies implementation.
Diffstat (limited to '')
-rw-r--r--src/test/test-fd-util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c
index f555bb976c..4425b5fe5f 100644
--- a/src/test/test-fd-util.c
+++ b/src/test/test-fd-util.c
@@ -94,10 +94,20 @@ static void test_same_fd(void) {
assert_se(same_fd(b, a) == 0);
}
+static void test_open_serialization_fd(void) {
+ _cleanup_close_ int fd = -1;
+
+ fd = open_serialization_fd("test");
+ assert_se(fd >= 0);
+
+ write(fd, "test\n", 5);
+}
+
int main(int argc, char *argv[]) {
test_close_many();
test_close_nointr();
test_same_fd();
+ test_open_serialization_fd();
return 0;
}