From a7bc47532b1e3d7db89fe9fe4521306fd6170617 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 28 Mar 2019 09:29:00 -0400 Subject: [PATCH] test_routerkeys.c: Always check mkdir() return value After this fix, we have no more unchecked mkdir() calls. Bug 29939; CID 144254. Bugfix on 0.2.7.2-alpha. --- changes/bug29939 | 4 ++++ src/test/test_routerkeys.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changes/bug29939 diff --git a/changes/bug29939 b/changes/bug29939 new file mode 100644 index 0000000000..0e9b46c075 --- /dev/null +++ b/changes/bug29939 @@ -0,0 +1,4 @@ + o Minor bugfixes (unit tests): + - In the "routerkeys/*" tests, check the return values of mkdir() for + possible failures. Fixes bug 29939; bugfix on 0.2.7.2-alpha. Found by + Coverity as CID 1444254. diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c index 727fa5660f..102d9334a1 100644 --- a/src/test/test_routerkeys.c +++ b/src/test/test_routerkeys.c @@ -455,11 +455,11 @@ test_routerkeys_ed_keys_init_all(void *arg) options->TestingLinkKeySlop = 2*3600; #ifdef _WIN32 - mkdir(dir); - mkdir(keydir); + tt_int_op(0, OP_EQ, mkdir(dir)); + tt_int_op(0, OP_EQ, mkdir(keydir)); #else - mkdir(dir, 0700); - mkdir(keydir, 0700); + tt_int_op(0, OP_EQ, mkdir(dir, 0700)); + tt_int_op(0, OP_EQ, mkdir(keydir, 0700)); #endif /* defined(_WIN32) */ options->DataDirectory = dir;