]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove needless fd var from test. CID 1130989.
authorNick Mathewson <nickm@torproject.org>
Fri, 22 Nov 2013 17:16:17 +0000 (12:16 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 22 Nov 2013 17:16:17 +0000 (12:16 -0500)
src/test/test_util.c

index ab5928ffd4d5f5193f3f5a3ab99b3985959c14c3..376e3aab8e311ba9a9b175559db321cc0fb0b445 100644 (file)
@@ -112,7 +112,6 @@ test_util_write_chunks_to_file(void *arg)
   char *tempname = NULL;
   char *str = NULL;
   int r;
-  int fd = -1;
   struct stat st;
 
   /* These should be two different sizes to ensure the data is different
@@ -155,7 +154,6 @@ test_util_write_chunks_to_file(void *arg)
   tt_int_op(st.st_size, ==, data_str_len);
   test_mem_op(data_str, ==, str, data_str_len);
   tor_free(str);
-  close(fd);
 
   // assert that the tempfile is removed (should not leave artifacts)
   str = read_file_to_str(tempname, RFTS_BIN|RFTS_IGNORE_MISSING, &st);
@@ -187,7 +185,6 @@ test_util_write_chunks_to_file(void *arg)
   tt_int_op(st.st_size, ==, data_str_len);
   test_mem_op(data_str, ==, str, data_str_len);
   tor_free(str);
-  close(fd);
 
   // assert the tempfile still contains the known string
   str = read_file_to_str(tempname, RFTS_BIN, &st);
@@ -204,8 +201,6 @@ test_util_write_chunks_to_file(void *arg)
   tor_free(str);
   tor_free(data_str);
   tor_free(temp_str);
-  if (fd >= 0)
-    close(fd);
 }
 
 static void