From f6fd90c99aea8b604d76ae49d29bc5269c236a98 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 6 Jun 2019 18:59:16 +0200 Subject: [PATCH] tests: Minor fix to run-threaded.c. * tests/run-threaded.c (random_data_close): Correct FD test. -- An invalid DS is -1 and not 0; this fix is for correctness and does not chnage anything in the real world. Signed-off-by: Werner Koch --- tests/run-threaded.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/run-threaded.c b/tests/run-threaded.c index 0e46bd2d..1fe4f192 100644 --- a/tests/run-threaded.c +++ b/tests/run-threaded.c @@ -284,6 +284,9 @@ random_data_new (const char *fname) { data_t ret = calloc (1, sizeof (struct data_s)); int data_rand; + + ret->fd = -1; + if (data_type) { data_rand = data_type; @@ -357,7 +360,8 @@ random_data_close (data_t data) { gpgme_data_release (data->dh); } - if (data->fd) + + if (data->fd != -1) { close (data->fd); }