[Privoxy-commits] [privoxy] 46/48: Check the chdir() return code

User Git git at git.privoxy.org
Thu Dec 17 14:18:22 UTC 2020


This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository privoxy.

commit 0fe40b4677a954bc7b4c843479f216bf1e2e9b3f
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Thu Dec 17 10:32:55 2020 +0100

    Check the chdir() return code
    
    ... to fix the compiler warning:
       jcc.c: In function ‘main’:
       jcc.c:5185:7: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result]
              chdir("/");
              ^~~~~~~~~~
---
 jcc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/jcc.c b/jcc.c
index 8d99b1f9..d8e25d5b 100644
--- a/jcc.c
+++ b/jcc.c
@@ -5182,7 +5182,10 @@ int main(int argc, char **argv)
       }
 #endif
 
-      chdir("/");
+      if (chdir("/") != 0)
+      {
+         log_error(LOG_LEVEL_FATAL, "Failed to cd into '/': %E");
+      }
 
    } /* -END- if (daemon_mode) */
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Privoxy-commits mailing list