diff options
| author | 2017-10-29 22:06:21 +0100 | |
|---|---|---|
| committer | 2017-10-29 22:06:21 +0100 | |
| commit | 46bdf3ec90acf3916ee8aba622a7da9da5eb8e06 (patch) | |
| tree | b210b2ef5a9e2587d82954f70b2582868d1ad7ab /src | |
| parent | b6ec966d105e9f72d3a5a671afe526f54f3d327f (diff) | |
| download | usbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.gz usbmuxd-46bdf3ec90acf3916ee8aba622a7da9da5eb8e06.tar.bz2 | |
conf: Report an error if writing to config file fails
Diffstat (limited to 'src')
| -rw-r--r-- | src/conf.c | 11 |
1 files changed, 8 insertions, 3 deletions
| @@ -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 | ||
| 264 | static int config_set_value(const char *key, plist_t value) | 264 | 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) | |||
| 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); |
