Fixed telldus-core segfault because of config file path not set in correct order
This commit is contained in:
parent
c92ede9524
commit
194ca57295
2 changed files with 13 additions and 9 deletions
|
@ -94,6 +94,14 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
|
|||
|
||||
IF (UNIX AND NOT APPLE)
|
||||
SET(SCRIPT_PATH "/usr/local/share/telldus/scripts" CACHE PATH "The paths for scripts to execute on sensor events")
|
||||
SET(SYSCONF_INSTALL_DIR "/etc" CACHE PATH "The sysconfig install dir (default prefix/etc)" )
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
SET(DEFAULT_STATE_INSTALL_DIR "/var/spool")
|
||||
ELSE ()
|
||||
SET(DEFAULT_STATE_INSTALL_DIR "/var/state")
|
||||
ENDIF ()
|
||||
SET(STATE_INSTALL_DIR "${DEFAULT_STATE_INSTALL_DIR}" CACHE PATH "The directory to store state information of the devices")
|
||||
|
||||
ENDIF()
|
||||
|
||||
######## Platforms-specific, non configurable ########
|
||||
|
@ -247,15 +255,6 @@ ENDIF (UNIX)
|
|||
|
||||
IF (UNIX AND NOT APPLE)
|
||||
INSTALL(TARGETS ${telldus-service_TARGET} RUNTIME DESTINATION sbin)
|
||||
SET(SYSCONF_INSTALL_DIR "/etc" CACHE PATH "The sysconfig install dir (default prefix/etc)" )
|
||||
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
SET(DEFAULT_STATE_INSTALL_DIR "/var/spool")
|
||||
ELSE ()
|
||||
SET(DEFAULT_STATE_INSTALL_DIR "/var/state")
|
||||
ENDIF ()
|
||||
SET(STATE_INSTALL_DIR "${DEFAULT_STATE_INSTALL_DIR}" CACHE PATH "The directory to store state information of the devices")
|
||||
|
||||
INSTALL(FILES tellstick.conf
|
||||
DESTINATION ${SYSCONF_INSTALL_DIR}
|
||||
)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "service/config.h"
|
||||
#include "client/telldus-core.h"
|
||||
#include "common/Strings.h"
|
||||
#include "service/Log.h"
|
||||
|
||||
class Settings::PrivateData {
|
||||
public:
|
||||
|
@ -405,12 +406,14 @@ bool readConfig(cfg_t **cfg) {
|
|||
|
||||
FILE *fp = fopen(CONFIG_FILE, "re"); // e for setting O_CLOEXEC on the file handle
|
||||
if (!fp) {
|
||||
Log::warning("Unable to open config file, %s", CONFIG_FILE);
|
||||
return false;
|
||||
}
|
||||
(*cfg) = cfg_init(opts, CFGF_NOCASE);
|
||||
if (cfg_parse_fp((*cfg), fp) == CFG_PARSE_ERROR) {
|
||||
(*cfg) = 0;
|
||||
fclose(fp);
|
||||
Log::warning("Unable to parse config file, %s", CONFIG_FILE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -432,12 +435,14 @@ bool readVarConfig(cfg_t **cfg) {
|
|||
|
||||
FILE *fp = fopen(VAR_CONFIG_FILE, "re"); // e for setting O_CLOEXEC on the file handle
|
||||
if (!fp) {
|
||||
Log::warning("Unable to open var config file, %s", VAR_CONFIG_FILE);
|
||||
return false;
|
||||
}
|
||||
(*cfg) = cfg_init(opts, CFGF_NOCASE);
|
||||
if (cfg_parse_fp((*cfg), fp) == CFG_PARSE_ERROR) {
|
||||
(*cfg) = 0;
|
||||
fclose(fp);
|
||||
Log::warning("Unable to parse var config file, %s", VAR_CONFIG_FILE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue