systemd/0163-test-fileio-replace-mk...

38 lines
1.2 KiB
Diff

From 622dfd7a6553cc27b6f75653481dd8808f717c49 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Thu, 12 Dec 2013 00:06:30 +0100
Subject: [PATCH] test-fileio: replace mktemp with mkstemp to avoid warnings
This is a fairly useless thing to do but it makes the compilers
and analyzers shut up about the use of mktemp.
---
src/test/test-fileio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 06f3e28..b005f3b 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -41,7 +41,9 @@ static void test_parse_env_file(void) {
char **i;
unsigned k;
- assert_se(mktemp(p));
+ fd = mkstemp(p);
+ assert_se(fd >= 0);
+ close(fd);
fd = mkostemp(t, O_CLOEXEC);
assert_se(fd >= 0);
@@ -152,7 +154,9 @@ static void test_parse_multiline_env_file(void) {
_cleanup_strv_free_ char **a = NULL, **b = NULL;
char **i;
- assert_se(mktemp(p));
+ fd = mkstemp(p);
+ assert_se(fd >= 0);
+ close(fd);
fd = mkostemp(t, O_CLOEXEC);
assert_se(fd >= 0);