1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

test: _cleanup_(unlink_tempfilep) in two more places

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-10-23 10:50:38 +02:00
parent d8351049a8
commit 75e7d50e26
2 changed files with 3 additions and 6 deletions

View File

@ -14,7 +14,7 @@
#include "macro.h"
static void test_clock_is_localtime(void) {
char adjtime[] = "/tmp/test-adjtime.XXXXXX";
_cleanup_(unlink_tempfilep) char adjtime[] = "/tmp/test-adjtime.XXXXXX";
_cleanup_fclose_ FILE* f = NULL;
static const struct scenario {
@ -52,8 +52,6 @@ static void test_clock_is_localtime(void) {
assert_se(write_string_stream(f, scenarios[i].contents, WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
assert_se(clock_is_localtime(adjtime) == scenarios[i].expected_result);
}
unlink(adjtime);
}
/* Test with the real /etc/adjtime */

View File

@ -6,6 +6,7 @@
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "serialize.h"
#include "string-util.h"
#include "strv.h"
@ -321,7 +322,7 @@ static void test_deserialize_environment(void) {
static void test_serialize_environment(void) {
_cleanup_strv_free_ char **env = NULL, **env2 = NULL;
char fn[] = "/tmp/test-env-util.XXXXXXX";
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-env-util.XXXXXXX";
_cleanup_fclose_ FILE *f = NULL;
int r;
@ -358,8 +359,6 @@ static void test_serialize_environment(void) {
assert_se(feof(f));
assert_se(strv_equal(env, env2));
unlink(fn);
}
int main(int argc, char *argv[]) {