diff options
author | Michael Adam <obnox@samba.org> | 2009-12-07 00:30:41 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-12-07 00:32:22 +0100 |
commit | 1360f530f1b2e1b703d28a19e643d4deec1f083a (patch) | |
tree | 88f4602a5a368a0f537a75aaee9dd6f2727095d3 /src | |
parent | d0a91c2f9bdc6cc98827584e60526098fd28d28b (diff) | |
download | tinyproxy-1360f530f1b2e1b703d28a19e643d4deec1f083a.tar.gz tinyproxy-1360f530f1b2e1b703d28a19e643d4deec1f083a.zip |
Don't make config_file const in the config struct.
Michael
Diffstat (limited to '')
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/main.h | 2 |
2 files changed, 9 insertions, 2 deletions
@@ -215,6 +215,9 @@ process_cmdline (int argc, char **argv, struct config_s *conf) break; case 'c': + if (conf->config_file != NULL) { + safefree (conf->config_file); + } conf->config_file = safestrdup (optarg); if (!conf->config_file) { fprintf (stderr, @@ -305,7 +308,11 @@ static void initialize_config_defaults (struct config_s *conf) { memset (conf, 0, sizeof(*conf)); - conf->config_file = SYSCONFDIR "/tinyproxy.conf"; + conf->config_file = safestrdup (SYSCONFDIR "/tinyproxy.conf"); + if (!conf->config_file) { + fprintf (stderr, PACKAGE ": Could not allocate memory.\n"); + exit (EX_SOFTWARE); + } conf->godaemon = TRUE; /* * Make sure the HTML error pages array is NULL to begin with. @@ -35,7 +35,7 @@ */ struct config_s { char *logf_name; - const char *config_file; + char *config_file; unsigned int syslog; /* boolean */ int port; char *stathost; |