[sr-dev] git:master:c32c6f34: cfgt: be more verbose on disk errors

Victor Seva linuxmaniac at torreviejawireless.org
Fri Dec 15 12:59:19 CET 2017


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

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2017-12-15T12:51:03+01:00

cfgt: be more verbose on disk errors

based on https://github.com/sipwise/kamailio/commit/7157ca348cebb4534634459cd1e61e924eb4faf8
by Andreas Granig <agranig at sipwise.com>

---

Modified: src/modules/cfgt/cfgt_int.c

---

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

---

diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index e2f402f587..2a0777ebcb 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -21,6 +21,8 @@
  */
 #include <stdio.h>
 #include <sys/stat.h>
+#include <string.h>
+#include <errno.h>
 
 #include "../../core/events.h"
 #include "../../core/strutils.h"
@@ -334,7 +336,7 @@ void cfgt_save_node(cfgt_node_p node)
 	}
 	LM_DBG("dir [%s]\n", dest.s);
 	if(mkdir(dest.s, S_IRWXO | S_IXGRP | S_IRWXU) < 0) {
-		LM_ERR("failed to make directory (%d)\n", errno);
+		LM_ERR("failed to make directory: %s\n", strerror(errno));
 		return;
 	}
 	dest.s[dir] = '/';
@@ -349,7 +351,7 @@ void cfgt_save_node(cfgt_node_p node)
 			return;
 		}
 		if(fputs(dest.s, fp) < 0) {
-			LM_ERR("failed writing to file\n");
+			LM_ERR("failed writing to file: %s\n", strerror(errno));
 		}
 		fclose(fp);
 		node->jdoc.free_fn(dest.s);




More information about the sr-dev mailing list