diff options
author | Julian Andres Klode <jak@jak-linux.org> | 2017-11-24 13:08:20 +0300 |
---|---|---|
committer | Julian Andres Klode <jak@jak-linux.org> | 2017-11-24 13:10:28 +0300 |
commit | e8e0b93b3705c7431853cc3c7ead266b8d577b7b (patch) | |
tree | 87d6a3826944a2a0cf4d02924b8f7ed2db8ce34e | |
parent | c38374ab5b21464b6a5ee6137393b236faeceff0 (diff) |
Fix compilation error in get_config_path()
When inlining check_path(), gcc sees after the first snprintf()
call that pbuf might be null, and subsequently generates a warning
for the next snprintf() call. Since the code (erroneously) builds
with -Werror, this causes it to fail.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83139
-rw-r--r-- | src/common.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c index bc38671..1ca612a 100644 --- a/src/common.c +++ b/src/common.c @@ -15,6 +15,8 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) { char *path = default_path; if(check_path(path)) return path; + if (!pbuf) + goto err; // priority 1: env var PROXYCHAINS_CONF_FILE path = getenv(PROXYCHAINS_CONF_FILE_ENV_VAR); @@ -45,6 +47,7 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) { if(check_path(path)) return path; +err: perror("couldnt find configuration file"); exit(1); } |