[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] test_routerkeys.c: Always check mkdir() return value
commit a7bc47532b1e3d7db89fe9fe4521306fd6170617
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Mar 28 09:29:00 2019 -0400
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(-)
diff --git a/changes/bug29939 b/changes/bug29939
new file mode 100644
index 000000000..0e9b46c07
--- /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 727fa5660..102d9334a 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;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits