]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test_routerkeys.c: Always check mkdir() return value
authorNick Mathewson <nickm@torproject.org>
Thu, 28 Mar 2019 13:29:00 +0000 (09:29 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 28 Mar 2019 13:31:13 +0000 (09:31 -0400)
After this fix, we have no more unchecked mkdir() calls.

Bug 29939; CID 144254. Bugfix on 0.2.7.2-alpha.

changes/bug29939 [new file with mode: 0644]
src/test/test_routerkeys.c

diff --git a/changes/bug29939 b/changes/bug29939
new file mode 100644 (file)
index 0000000..0e9b46c
--- /dev/null
@@ -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.
index 727fa5660f8d27b8f8dca33188ec4e44670c4fb0..102d9334a1725ce10ad3b93f8e54233f6cceee43 100644 (file)
@@ -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;