[sr-dev] git:master:919dd727: core: improve error messages on permission problems for cfg/pid files and runtime dir

Henning Westerholt hw at skalatan.de
Fri Sep 6 12:14:05 CEST 2019


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

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-09-06T12:09:38+02:00

core: improve error messages on permission problems for cfg/pid files and runtime dir

---

Modified: src/core/daemonize.c
Modified: src/main.c

---

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

---

diff --git a/src/core/daemonize.c b/src/core/daemonize.c
index 98bf04dc78..4fa33ac063 100644
--- a/src/core/daemonize.c
+++ b/src/core/daemonize.c
@@ -350,7 +350,7 @@ int daemonize(char*  name,  int status_wait)
 		}
 		pid=getpid();
 		if ((pid_stream=fopen(pid_file, "w"))==NULL){
-			LM_WARN("unable to create pid file %s: %s\n",
+			LM_WARN("unable to create pid file %s: %s, check directory permissions\n",
 				pid_file, strerror(errno));
 			goto error;
 		}else{
diff --git a/src/main.c b/src/main.c
index 1b7004d8b0..ba64af67db 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2211,7 +2211,8 @@ int main(int argc, char** argv)
 		cfg_stream=fopen (cfg_file, "r");
 	}
 	if (cfg_stream==0){
-		fprintf(stderr, "ERROR: loading config file(%s): %s\n", cfg_file,
+		fprintf(stderr, "ERROR: loading config file(%s): %s,"
+				" check file and directory permissions\n", cfg_file,
 				strerror(errno));
 		goto error;
 	}
@@ -2551,8 +2552,8 @@ int main(int argc, char** argv)
 	/* create runtime dir if doesn't exist */
 	if (stat(runtime_dir, &st) == -1) {
 		if(mkdir(runtime_dir, 0700) == -1) {
-			LM_ERR("failed to create runtime dir %s\n", runtime_dir);
-			fprintf(stderr,  "failed to create runtime dir %s\n", runtime_dir);
+			LM_ERR("failed to create runtime dir %s, check directory permissions\n", runtime_dir);
+			fprintf(stderr, "failed to create runtime dir %s, check directory permissions\n", runtime_dir);
 			goto error;
 		}
 		if(sock_uid!=-1 || sock_gid!=-1) {




More information about the sr-dev mailing list