]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
chgrp the testing tempdir to ourself to clear the sticky bit
authorNick Mathewson <nickm@torproject.org>
Wed, 5 Nov 2014 19:27:05 +0000 (14:27 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 5 Nov 2014 19:28:34 +0000 (14:28 -0500)
Closes 13678.  Doesn't actually matter for older tors.

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

diff --git a/changes/bug13678 b/changes/bug13678
new file mode 100644 (file)
index 0000000..d71b88a
--- /dev/null
@@ -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.
+
index 203b7489df489714e9973d8d89d94568731d218b..8b74c0a87ab62fbcfc21414259e729a046feebb4 100644 (file)
@@ -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);