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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-02-20 18:49:09 -05:00
parent 18f71a3c81
commit 504afd7c34
4 changed files with 34 additions and 13 deletions
+10
View File
@@ -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;
}