summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-10-29 22:06:21 +0100
committerGravatar Nikias Bassen2017-10-29 22:06:21 +0100
commit46bdf3ec90acf3916ee8aba622a7da9da5eb8e06 (patch)
treeb210b2ef5a9e2587d82954f70b2582868d1ad7ab
parentb6ec966d105e9f72d3a5a671afe526f54f3d327f (diff)
downloadusbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.gz
usbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.bz2
conf: Report an error if writing to config file fails
-rw-r--r--src/conf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/conf.c b/src/conf.c
index 9c9233a..f211d99 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -254,11 +254,11 @@ static int internal_set_value(const char *config_file, const char *key, plist_t
usbmuxd_log(LL_DEBUG, "setting key %s in config_file %s", key, config_file);
}
- plist_write_to_filename(config, config_file, PLIST_FORMAT_XML);
+ int res = plist_write_to_filename(config, config_file, PLIST_FORMAT_XML);
plist_free(config);
- return 1;
+ return res;
}
static int config_set_value(const char *key, plist_t value)
@@ -273,6 +273,9 @@ static int config_set_value(const char *key, plist_t value)
config_file = string_concat(config_path, DIR_SEP_S, CONFIG_FILE, NULL);
int result = internal_set_value(config_file, key, value);
+ if (!result) {
+ usbmuxd_log(LL_ERROR, "ERROR: Failed to write to '%s': %s", config_file, strerror(errno));
+ }
free(config_file);
@@ -378,7 +381,9 @@ void config_get_system_buid(char **system_buid)
/* no config, generate system_buid */
usbmuxd_log(LL_DEBUG, "no previous %s found", CONFIG_SYSTEM_BUID_KEY);
*system_buid = config_generate_system_buid();
- config_set_system_buid(*system_buid);
+ if (!config_set_system_buid(*system_buid)) {
+ usbmuxd_log(LL_WARNING, "WARNING: Failed to store SystemBUID, this might be a problem");
+ }
}
usbmuxd_log(LL_DEBUG, "using %s as %s", *system_buid, CONFIG_SYSTEM_BUID_KEY);