[pacman-dev] [PATCH] check config_new return value

Andrew Gregory andrew.gregory.8 at gmail.com
Mon Mar 24 09:59:42 EDT 2014


Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 src/pacman/pacman.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 9791ced..ef86d39 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1045,7 +1045,10 @@ int main(int argc, char *argv[])
 	setuseragent();
 
 	/* init config data */
-	config = config_new();
+	if(!(config = config_new())) {
+		/* config_new prints the appropriate error message */
+		cleanup(1);
+	}
 
 	/* disable progressbar if the output is redirected */
 	if(!isatty(fileno(stdout))) {
-- 
1.9.0



More information about the pacman-dev mailing list