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.
This commit is contained in:
Nick Mathewson 2019-03-28 09:29:00 -04:00
parent 00ca3d04cf
commit a7bc47532b
2 changed files with 8 additions and 4 deletions

4
changes/bug29939 Normal file
View File

@ -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.

View File

@ -455,11 +455,11 @@ test_routerkeys_ed_keys_init_all(void *arg)
options->TestingLinkKeySlop = 2*3600; options->TestingLinkKeySlop = 2*3600;
#ifdef _WIN32 #ifdef _WIN32
mkdir(dir); tt_int_op(0, OP_EQ, mkdir(dir));
mkdir(keydir); tt_int_op(0, OP_EQ, mkdir(keydir));
#else #else
mkdir(dir, 0700); tt_int_op(0, OP_EQ, mkdir(dir, 0700));
mkdir(keydir, 0700); tt_int_op(0, OP_EQ, mkdir(keydir, 0700));
#endif /* defined(_WIN32) */ #endif /* defined(_WIN32) */
options->DataDirectory = dir; options->DataDirectory = dir;