chiark / gitweb /
test-fileio: replace mktemp with mkstemp to avoid warnings
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Wed, 11 Dec 2013 23:06:30 +0000 (00:06 +0100)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Thu, 12 Dec 2013 01:46:09 +0000 (02:46 +0100)
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

index 06f3e28288abb0542ddf3c3c7770df746e0c5d00..b005f3b4e6ca920650f4794d2e412962924a49c1 100644 (file)
@@ -41,7 +41,9 @@ static void test_parse_env_file(void) {
         char **i;
         unsigned k;
 
         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);
 
         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;
 
         _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);
 
         fd = mkostemp(t, O_CLOEXEC);
         assert_se(fd >= 0);