Quellcode durchsuchen

Always use the sandbox in tor_open_cloexec

Use the sandbox in tor_open_cloexec, whether or not O_CLOEXEC is defined.
Patch by "teor". Fix on 0.2.3.1-alpha.
teor vor 8 Jahren
Ursprung
Commit
57c61f39a0
2 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 3 0
      changes/bug16515-sandbox-cloexec
  2. 1 2
      src/common/compat.c

+ 3 - 0
changes/bug16515-sandbox-cloexec

@@ -0,0 +1,3 @@
+  o Minor fixes (sandbox, files):
+    - Use the sandbox in tor_open_cloexec whether or not O_CLOEXEC is defined.
+      Patch by "teor". Fix on 0.2.3.1-alpha.

+ 1 - 2
src/common/compat.c

@@ -150,9 +150,8 @@ int
 tor_open_cloexec(const char *path, int flags, unsigned mode)
 {
   int fd;
-  const char *p = path;
+  const char *p = sandbox_intern_string(path);
 #ifdef O_CLOEXEC
-  p = sandbox_intern_string(path);
   fd = open(p, flags|O_CLOEXEC, mode);
   if (fd >= 0)
     return fd;