diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2010-10-18 00:55:16 +0200 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2010-10-18 00:55:16 +0200 |
commit | 10e23dda641022f4fa4a8fe529cacb9913b08e52 (patch) | |
tree | de86287023b2cb669b2bf7ab27c854ba8d5a92d1 /src/config-ini.c | |
parent | Separate the redshift.svg icon into an application icon and a status icon (diff) | |
download | redshift-ng-10e23dda641022f4fa4a8fe529cacb9913b08e52.tar.gz redshift-ng-10e23dda641022f4fa4a8fe529cacb9913b08e52.tar.bz2 redshift-ng-10e23dda641022f4fa4a8fe529cacb9913b08e52.tar.xz |
config-ini.c: Fix loading explicitly requested config file.
Diffstat (limited to 'src/config-ini.c')
-rw-r--r-- | src/config-ini.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/config-ini.c b/src/config-ini.c index 01ba99c..5231ba5 100644 --- a/src/config-ini.c +++ b/src/config-ini.c @@ -39,6 +39,8 @@ static FILE * open_config_file(const char *filepath) { + FILE *f = NULL; + if (filepath == NULL) { char cp[MAX_CONFIG_PATH]; char *env; @@ -54,21 +56,21 @@ open_config_file(const char *filepath) } if (filepath != NULL) { - FILE *f = fopen(filepath, "r"); + f = fopen(filepath, "r"); if (f != NULL) return f; else if (f == NULL && errno != ENOENT) return NULL; } /* TODO look in getenv("XDG_CONFIG_DIRS") */ } else { - FILE *f = fopen(filepath, "r"); + f = fopen(filepath, "r"); if (f == NULL) { perror("fopen"); return NULL; } } - return NULL; + return f; } int |