summaryrefslogtreecommitdiff
path: root/src/test/test-fileio.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-28 13:47:35 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-28 13:47:35 +0100
commit2d5bdf5bc0e4714d42e5999a4e37553a6bf83575 (patch)
treeea5e964d2761f1dcd29ba9bb53b869569a6292bf /src/test/test-fileio.c
parent7736202ce9149942e96e525c08d508daa448aff5 (diff)
always use the same code for creating temporary files
Let's unify our code here, and also always specifiy O_CLOEXEC.
Diffstat (limited to 'src/test/test-fileio.c')
-rw-r--r--src/test/test-fileio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index eb4fbc91d2..47a0907f90 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -41,11 +41,11 @@ static void test_parse_env_file(void) {
char **i;
unsigned k;
- fd = mkstemp(p);
+ fd = mkostemp_safe(p, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
close(fd);
- fd = mkostemp(t, O_CLOEXEC);
+ fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
f = fdopen(fd, "w");
@@ -154,11 +154,11 @@ static void test_parse_multiline_env_file(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL;
char **i;
- fd = mkstemp(p);
+ fd = mkostemp_safe(p, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
close(fd);
- fd = mkostemp(t, O_CLOEXEC);
+ fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
f = fdopen(fd, "w");
@@ -207,7 +207,7 @@ static void test_executable_is_script(void) {
FILE *f;
char *command;
- fd = mkostemp(t, O_CLOEXEC);
+ fd = mkostemp_safe(t, O_RDWR|O_CLOEXEC);
assert_se(fd >= 0);
f = fdopen(fd, "w");