[sr-dev] git:master:9a7fee2d: cfgt: check error case for mkdir()

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 31 15:54:48 CEST 2017


Module: kamailio
Branch: master
Commit: 9a7fee2dac2f59c277d2634937c7449b9659a20d
URL: https://github.com/kamailio/kamailio/commit/9a7fee2dac2f59c277d2634937c7449b9659a20d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-31T15:54:27+02:00

cfgt: check error case for mkdir()

---

Modified: src/modules/cfgt/cfgt_int.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9a7fee2dac2f59c277d2634937c7449b9659a20d.diff
Patch: https://github.com/kamailio/kamailio/commit/9a7fee2dac2f59c277d2634937c7449b9659a20d.patch

---

diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index 56292fb1a2..20fcfb0fb8 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -362,7 +362,10 @@ void cfgt_save_node(cfgt_node_p node)
 		return;
 	}
 	LM_DBG("dir [%s]\n", dest.s);
-	mkdir(dest.s, S_IRWXO|S_IXGRP|S_IRWXU);
+	if(mkdir(dest.s, S_IRWXO|S_IXGRP|S_IRWXU)<0) {
+		LM_ERR("failed to make directory (%d)\n", errno);
+		return;
+	}
 	dest.s[dir] = '/';
 	fp = fopen(dest.s, "w");
 	LM_DBG("file [%s]\n", dest.s);




More information about the sr-dev mailing list