commit 448f1a79127ef1088544995088bc912c27f2a66e
parent 5fa964c5c0c9be9cd484e9d6af73669726255be8
Author: Joris Vink <joris@coders.se>
Date:   Fri,  1 Aug 2014 16:39:12 +0200
Don't run cli_cleanup_files() in cli_fatal if theres no rootdir
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/cli.c b/src/cli.c
@@ -715,11 +715,14 @@ cli_fatal(const char *fmt, ...)
 	(void)vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 
-	l = snprintf(spath, sizeof(spath), "%s/.objs", rootdir);
-	if (l == -1 || (size_t)l >= sizeof(spath)) {
-		printf("couldn't create spath for cleanup: %s\n", errno_s);
-	} else {
-		cli_cleanup_files(spath);
+	if (rootdir != NULL) {
+		l = snprintf(spath, sizeof(spath), "%s/.objs", rootdir);
+		if (l == -1 || (size_t)l >= sizeof(spath)) {
+			printf("couldn't create spath for cleanup: %s\n",
+			    errno_s);
+		} else {
+			cli_cleanup_files(spath);
+		}
 	}
 
 	if (command != NULL)