cfgt: check error case for mkdir()
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 31 Jul 2017 12:57:18 +0000 (14:57 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 31 Jul 2017 13:54:27 +0000 (15:54 +0200)
src/modules/cfgt/cfgt_int.c

index 56292fb..20fcfb0 100644 (file)
@@ -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);