summaryrefslogtreecommitdiff
path: root/tests/run-threaded.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-06-06 18:59:16 +0200
committerWerner Koch <wk@gnupg.org>2019-06-06 18:59:16 +0200
commitf6fd90c99aea8b604d76ae49d29bc5269c236a98 (patch)
tree3b27962ae27f4df002f8504d1736d138e3053571 /tests/run-threaded.c
parentf84abcad253ace782708c05760e52793814896f4 (diff)
downloadgpgme-f6fd90c99aea8b604d76ae49d29bc5269c236a98.tar.gz
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 <wk@gnupg.org>
Diffstat (limited to 'tests/run-threaded.c')
-rw-r--r--tests/run-threaded.c6
1 files changed, 5 insertions, 1 deletions
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);
}