summaryrefslogtreecommitdiffstats
path: root/src/conf.c
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 /src/conf.c
parentb6ec966d105e9f72d3a5a671afe526f54f3d327f (diff)
downloadusbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.gz
usbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.bz2
conf: Report an error if writing to config file fails
Diffstat (limited to 'src/conf.c')
-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
254 usbmuxd_log(LL_DEBUG, "setting key %s in config_file %s", key, config_file); 254 usbmuxd_log(LL_DEBUG, "setting key %s in config_file %s", key, config_file);
255 } 255 }
256 256
257 plist_write_to_filename(config, config_file, PLIST_FORMAT_XML); 257 int res = plist_write_to_filename(config, config_file, PLIST_FORMAT_XML);
258 258
259 plist_free(config); 259 plist_free(config);
260 260
261 return 1; 261 return res;
262} 262}
263 263
264static int config_set_value(const char *key, plist_t value) 264static 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)
273 config_file = string_concat(config_path, DIR_SEP_S, CONFIG_FILE, NULL); 273 config_file = string_concat(config_path, DIR_SEP_S, CONFIG_FILE, NULL);
274 274
275 int result = internal_set_value(config_file, key, value); 275 int result = internal_set_value(config_file, key, value);
276 if (!result) {
277 usbmuxd_log(LL_ERROR, "ERROR: Failed to write to '%s': %s", config_file, strerror(errno));
278 }
276 279
277 free(config_file); 280 free(config_file);
278 281
@@ -378,7 +381,9 @@ void config_get_system_buid(char **system_buid)
378 /* no config, generate system_buid */ 381 /* no config, generate system_buid */
379 usbmuxd_log(LL_DEBUG, "no previous %s found", CONFIG_SYSTEM_BUID_KEY); 382 usbmuxd_log(LL_DEBUG, "no previous %s found", CONFIG_SYSTEM_BUID_KEY);
380 *system_buid = config_generate_system_buid(); 383 *system_buid = config_generate_system_buid();
381 config_set_system_buid(*system_buid); 384 if (!config_set_system_buid(*system_buid)) {
385 usbmuxd_log(LL_WARNING, "WARNING: Failed to store SystemBUID, this might be a problem");
386 }
382 } 387 }
383 388
384 usbmuxd_log(LL_DEBUG, "using %s as %s", *system_buid, CONFIG_SYSTEM_BUID_KEY); 389 usbmuxd_log(LL_DEBUG, "using %s as %s", *system_buid, CONFIG_SYSTEM_BUID_KEY);