Skip to content

Commit fe4f8fd

Browse files
committed
test-clock: fix fd "leak"
CID #1352301.
1 parent 3113d88 commit fe4f8fd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/test-clock.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@
2020
#include <unistd.h>
2121
#include <fcntl.h>
2222

23-
#include "macro.h"
23+
#include "clock-util.h"
24+
#include "fd-util.h"
2425
#include "fileio.h"
2526
#include "log.h"
26-
#include "clock-util.h"
27+
#include "macro.h"
2728

2829
static void test_clock_is_localtime(void) {
2930
char adjtime[] = "/tmp/test-adjtime.XXXXXX";
30-
int fd;
31+
_cleanup_close_ int fd = -1;
3132
FILE* f;
3233

33-
const struct scenario {
34+
static const struct scenario {
3435
const char* contents;
3536
int expected_result;
3637
} scenarios[] = {

0 commit comments

Comments
 (0)