[tor-commits] [tor/master] Avoid unused function warnings on libc's without GLOB_ALTDIRFUNC #40354

asn at torproject.org asn at torproject.org
Thu Apr 8 11:37:43 UTC 2021


commit 272cb803df02179bd6d406d0188df588d445db1b
Author: Daniel Pinto <danielpinto52 at gmail.com>
Date:   Wed Mar 24 22:20:29 2021 +0000

    Avoid unused function warnings on libc's without GLOB_ALTDIRFUNC #40354
---
 changes/bug40354  | 4 ++++
 src/lib/fs/path.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/changes/bug40354 b/changes/bug40354
new file mode 100644
index 0000000000..da7c63d3af
--- /dev/null
+++ b/changes/bug40354
@@ -0,0 +1,4 @@
+  o Minor bugfixes (compilation):
+    - Fix a compilation warning about unused functions when building with
+      a libc that lacks the GLOB_ALTDIRFUNC constant. Fixes bug 40354;
+      bugfix on 0.4.5.1-alpha. Patch by Daniel Pinto.
diff --git a/src/lib/fs/path.c b/src/lib/fs/path.c
index c2fdddb9db..dc1741447e 100644
--- a/src/lib/fs/path.c
+++ b/src/lib/fs/path.c
@@ -533,6 +533,7 @@ unglob_win32(const char *pattern, int prev_sep, int next_sep)
   return result;
 }
 #elif HAVE_GLOB
+#ifdef GLOB_ALTDIRFUNC  // prevent warning about unused functions
 /** Same as opendir but calls sandbox_intern_string before */
 static DIR *
 prot_opendir(const char *name)
@@ -571,6 +572,7 @@ wrap_closedir(void *arg)
 {
   closedir(arg);
 }
+#endif /* defined(GLOB_ALTDIRFUNC) */
 #endif /* defined(HAVE_GLOB) */
 
 /** Return a new list containing the paths that match the pattern





More information about the tor-commits mailing list