Browse code

cfgt: check error case for mkdir()

Daniel-Constantin Mierla authored on 31/07/2017 12:57:18
Showing 1 changed files
... ...
@@ -362,7 +362,10 @@ void cfgt_save_node(cfgt_node_p node)
362 362
 		return;
363 363
 	}
364 364
 	LM_DBG("dir [%s]\n", dest.s);
365
-	mkdir(dest.s, S_IRWXO|S_IXGRP|S_IRWXU);
365
+	if(mkdir(dest.s, S_IRWXO|S_IXGRP|S_IRWXU)<0) {
366
+		LM_ERR("failed to make directory (%d)\n", errno);
367
+		return;
368
+	}
366 369
 	dest.s[dir] = '/';
367 370
 	fp = fopen(dest.s, "w");
368 371
 	LM_DBG("file [%s]\n", dest.s);