Sfoglia il codice sorgente

chgrp the testing tempdir to ourself to clear the sticky bit

Closes 13678.  Doesn't actually matter for older tors.
Nick Mathewson 11 anni fa
parent
commit
1dcc492295
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 6 0
      changes/bug13678
  2. 4 0
      src/test/test.c

+ 6 - 0
changes/bug13678

@@ -0,0 +1,6 @@
+
+  o Testing:
+    - In the unit tests, use 'chgrp' to change the group of the unit test
+      temporary directory to the current user, so that the sticky bit doesn't
+      interfere with tests that check directory groups. Closes 13678.
+

+ 4 - 0
src/test/test.c

@@ -123,6 +123,10 @@ setup_directory(void)
   tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
                (int) getpid(), rnd32);
   r = mkdir(temp_dir, 0700);
+  if (!r) {
+    /* undo sticky bit so tests don't get confused. */
+    r = chown(temp_dir, getuid(), getgid());
+  }
 #endif
   if (r) {
     fprintf(stderr, "Can't create directory %s:", temp_dir);