Loading etc/openwrt/its_bridge/webserver.conf +2 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,6 @@ realm=vendors login=guest password=password https_port=8888 cert_pem=/etc/its_bridge/certs/server.pem cert_key=/etc/its_bridge/certs/server.key cert_pem=/etc/its_bridge/certs/its_bridge.pem cert_key=/etc/its_bridge/certs/its_bridge.key conf_path=/etc/its_bridge src/its_web_server_config.c +2 −1 Original line number Diff line number Diff line Loading @@ -647,13 +647,14 @@ int32_t main(const int32_t p_argc, char* const p_argv[]) { fprintf(stderr, "Failed to parse configuration file: conf_path missing, exit.\n"); goto error; } printf("realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.\n", realm, login, password, cert_pem, cert_key, conf_path); /* Daemonize */ if (daemonized) { daemonize(); } printf("realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.\n", realm, login, password, cert_pem, cert_key, conf_path); /* Here is either the main process is not deamonized or th echild process if deamonized */ set_pid_file(PID_FILE_NAME); /* Set PID file */ set_lock_file(LOCK_FILE_NAME); /* Set lock file */ Loading src/utils.c +13 −7 Original line number Diff line number Diff line Loading @@ -349,11 +349,11 @@ void daemonize() { } if (pid > 0) { printf("daemonize: parent exists.\n"); exit(0); exit(2); } /* Child (daemon) continues */ printf("daemonize: child started: %d.\n", pid); printf("daemonize: child started: %d.\n", getpid()); if (setsid() < 0) { /* Obtain a new process group */ fprintf(stderr, "daemonize: 'setsid' operation failure: %s.\n", strerror(errno)); exit(-1); Loading @@ -366,7 +366,7 @@ void daemonize() { i = open("/dev/null", O_RDWR); /* Redirection of standards outputs */ dup(i); dup(i); umask(027); /* Set newly created file permissions */ umask(0); /* Set newly created file permissions */ /* Ignore part of signals */ signal(SIGCHLD,SIG_IGN); Loading Loading @@ -419,6 +419,8 @@ long get_file_size(const char *p_filename) { } fclose(fp); return size; } else { fprintf(stderr, "get_file_size: Failed to open file: %s.\n", p_filename); } return 0; Loading @@ -427,22 +429,26 @@ long get_file_size(const char *p_filename) { char* load_file (const char *p_filename) { size_t size = get_file_size(p_filename); if (size == 0) { fprintf(stderr, "load_file: Wrong file size: %s.\n", p_filename); return NULL; } FILE* fp = fopen (p_filename, "rb"); if (fp == NULL) { fprintf(stderr, "load_file: Failed to open file: %s.\n", strerror(errno)); return NULL; } char* buffer = malloc(size + 1); if (buffer == NULL) { fprintf(stderr, "load_file: Failed to allocate memory: %s.\n", strerror(errno)); fclose (fp); return NULL; } buffer[size] = '\0'; if ((long)fread(buffer, 1, size, fp) != size) { fprintf(stderr, "load_file: Failed to read file: %s.\n", strerror(errno)); free (buffer); buffer = NULL; } Loading Loading
etc/openwrt/its_bridge/webserver.conf +2 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,6 @@ realm=vendors login=guest password=password https_port=8888 cert_pem=/etc/its_bridge/certs/server.pem cert_key=/etc/its_bridge/certs/server.key cert_pem=/etc/its_bridge/certs/its_bridge.pem cert_key=/etc/its_bridge/certs/its_bridge.key conf_path=/etc/its_bridge
src/its_web_server_config.c +2 −1 Original line number Diff line number Diff line Loading @@ -647,13 +647,14 @@ int32_t main(const int32_t p_argc, char* const p_argv[]) { fprintf(stderr, "Failed to parse configuration file: conf_path missing, exit.\n"); goto error; } printf("realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.\n", realm, login, password, cert_pem, cert_key, conf_path); /* Daemonize */ if (daemonized) { daemonize(); } printf("realm=%s, login=%s:%s, pem=%s, key=%s, conf_path=%s.\n", realm, login, password, cert_pem, cert_key, conf_path); /* Here is either the main process is not deamonized or th echild process if deamonized */ set_pid_file(PID_FILE_NAME); /* Set PID file */ set_lock_file(LOCK_FILE_NAME); /* Set lock file */ Loading
src/utils.c +13 −7 Original line number Diff line number Diff line Loading @@ -349,11 +349,11 @@ void daemonize() { } if (pid > 0) { printf("daemonize: parent exists.\n"); exit(0); exit(2); } /* Child (daemon) continues */ printf("daemonize: child started: %d.\n", pid); printf("daemonize: child started: %d.\n", getpid()); if (setsid() < 0) { /* Obtain a new process group */ fprintf(stderr, "daemonize: 'setsid' operation failure: %s.\n", strerror(errno)); exit(-1); Loading @@ -366,7 +366,7 @@ void daemonize() { i = open("/dev/null", O_RDWR); /* Redirection of standards outputs */ dup(i); dup(i); umask(027); /* Set newly created file permissions */ umask(0); /* Set newly created file permissions */ /* Ignore part of signals */ signal(SIGCHLD,SIG_IGN); Loading Loading @@ -419,6 +419,8 @@ long get_file_size(const char *p_filename) { } fclose(fp); return size; } else { fprintf(stderr, "get_file_size: Failed to open file: %s.\n", p_filename); } return 0; Loading @@ -427,22 +429,26 @@ long get_file_size(const char *p_filename) { char* load_file (const char *p_filename) { size_t size = get_file_size(p_filename); if (size == 0) { fprintf(stderr, "load_file: Wrong file size: %s.\n", p_filename); return NULL; } FILE* fp = fopen (p_filename, "rb"); if (fp == NULL) { fprintf(stderr, "load_file: Failed to open file: %s.\n", strerror(errno)); return NULL; } char* buffer = malloc(size + 1); if (buffer == NULL) { fprintf(stderr, "load_file: Failed to allocate memory: %s.\n", strerror(errno)); fclose (fp); return NULL; } buffer[size] = '\0'; if ((long)fread(buffer, 1, size, fp) != size) { fprintf(stderr, "load_file: Failed to read file: %s.\n", strerror(errno)); free (buffer); buffer = NULL; } Loading