[tor-commits] [tor/main] Fix compilation error when __NR_time is not defined. #40465

ahf at torproject.org ahf at torproject.org
Thu Oct 14 13:01:39 UTC 2021


commit 7a06b8713dde2cf736c5fa0c70dae0f43fac81f1
Author: Daniel Pinto <danielpinto52 at gmail.com>
Date:   Thu Sep 9 23:55:49 2021 +0100

    Fix compilation error when __NR_time is not defined. #40465
---
 changes/bug40465          | 3 +++
 src/lib/sandbox/sandbox.c | 9 +++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/changes/bug40465 b/changes/bug40465
new file mode 100644
index 0000000000..d4d225c62e
--- /dev/null
+++ b/changes/bug40465
@@ -0,0 +1,3 @@
+  o Minor bugfixes (compilation):
+    - Fix compilation error when __NR_time is not defined. Fixes bug
+      40465; bugfix on 0.2.5.5-alpha. Patch by Daniel Pinto.
diff --git a/src/lib/sandbox/sandbox.c b/src/lib/sandbox/sandbox.c
index 02222e5a1c..091234e6b9 100644
--- a/src/lib/sandbox/sandbox.c
+++ b/src/lib/sandbox/sandbox.c
@@ -339,6 +339,7 @@ sb_rt_sigaction(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
   return rc;
 }
 
+#ifdef __NR_time
 /**
  * Function responsible for setting up the time syscall for
  * the seccomp filter sandbox.
@@ -347,13 +348,11 @@ static int
 sb_time(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
 {
   (void) filter;
-#ifdef __NR_time
+
   return seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(time),
        SCMP_CMP(0, SCMP_CMP_EQ, 0));
-#else
-  return 0;
-#endif /* defined(__NR_time) */
 }
+#endif /* defined(__NR_time) */
 
 /**
  * Function responsible for setting up the accept4 syscall for
@@ -1192,7 +1191,9 @@ sb_kill(scmp_filter_ctx ctx, sandbox_cfg_t *filter)
 static sandbox_filter_func_t filter_func[] = {
     sb_rt_sigaction,
     sb_rt_sigprocmask,
+#ifdef __NR_time
     sb_time,
+#endif
     sb_accept4,
 #ifdef __NR_mmap2
     sb_mmap2,





More information about the tor-commits mailing list