Module: kamailio
Branch: master
Commit: 9a7fee2dac2f59c277d2634937c7449b9659a20d
URL:
https://github.com/kamailio/kamailio/commit/9a7fee2dac2f59c277d2634937c7449…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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/9a7fee2dac2f59c277d2634937c7449…
Patch:
https://github.com/kamailio/kamailio/commit/9a7fee2dac2f59c277d2634937c7449…
---
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);