[pacman-dev] [PATCH] fix segfault if pacman.conf can't be read
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- src/pacman/conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 3af3fa5..b724ae3 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -750,7 +750,7 @@ static int _parseconfig(const char *file, struct section_t *section, } cleanup: - fclose(fp); + if (fp) fclose(fp); pm_printf(ALPM_LOG_DEBUG, "config: finished parsing %s\n", file); return ret; } -- 1.7.6
On Tue, Jul 5, 2011 at 4:35 PM, Florian Pritz <bluewind@xinu.at> wrote:
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- src/pacman/conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 3af3fa5..b724ae3 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -750,7 +750,7 @@ static int _parseconfig(const char *file, struct section_t *section, }
cleanup: - fclose(fp); + if (fp) fclose(fp); Please see the style guide in HACKING and resubmit- all conditionals require {} and and should span multiple lines.
pm_printf(ALPM_LOG_DEBUG, "config: finished parsing %s\n", file); return ret; } -- 1.7.6
participants (2)
-
Dan McGee
-
Florian Pritz