瀏覽代碼

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

Henning Westerholt 6 年之前
父節點
當前提交
919dd72712
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 1 1
      src/core/daemonize.c
  2. 4 3
      src/main.c

+ 1 - 1
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{

+ 4 - 3
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 @@ try_again:
 	/* 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) {