summaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-08 03:01:18 +0200
committerGravatar Martin Szulecki2020-06-08 03:01:18 +0200
commit7317958e0c8f52bca6fd4deee1045d117e1b0619 (patch)
tree6a4b5b7f700c781b0a12c700e1546429daf139b1 /src/conf.c
parentea94e4c05360872cb9050b3f39299778d8621c20 (diff)
downloadusbmuxd-7317958e0c8f52bca6fd4deee1045d117e1b0619.tar.gz
usbmuxd-7317958e0c8f52bca6fd4deee1045d117e1b0619.tar.bz2
Improve and unify log message output for client, device and config
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/conf.c b/src/conf.c
index f211d99..db88e90 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -140,7 +140,7 @@ const char *config_get_config_dir()
140 140
141 free(base_config_dir); 141 free(base_config_dir);
142 142
143 usbmuxd_log(LL_DEBUG, "initialized config_dir to %s", __config_dir); 143 usbmuxd_log(LL_DEBUG, "Initialized config_dir to %s", __config_dir);
144 144
145 return __config_dir; 145 return __config_dir;
146} 146}
@@ -247,11 +247,11 @@ static int internal_set_value(const char *config_file, const char *key, plist_t
247 char *value_string = NULL; 247 char *value_string = NULL;
248 if (plist_get_node_type(value) == PLIST_STRING) { 248 if (plist_get_node_type(value) == PLIST_STRING) {
249 plist_get_string_val(value, &value_string); 249 plist_get_string_val(value, &value_string);
250 usbmuxd_log(LL_DEBUG, "setting key %s to %s in config_file %s", key, value_string, config_file); 250 usbmuxd_log(LL_DEBUG, "Setting key %s to %s in config file %s", key, value_string, config_file);
251 if (value_string) 251 if (value_string)
252 free(value_string); 252 free(value_string);
253 } else { 253 } else {
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 int res = plist_write_to_filename(config, config_file, PLIST_FORMAT_XML); 257 int res = plist_write_to_filename(config, config_file, PLIST_FORMAT_XML);
@@ -289,7 +289,7 @@ static int internal_get_value(const char* config_file, const char *key, plist_t
289 /* now parse file to get the SystemBUID */ 289 /* now parse file to get the SystemBUID */
290 plist_t config = NULL; 290 plist_t config = NULL;
291 if (plist_read_from_filename(&config, config_file)) { 291 if (plist_read_from_filename(&config, config_file)) {
292 usbmuxd_log(LL_DEBUG, "reading key %s from config_file %s", key, config_file); 292 usbmuxd_log(LL_DEBUG, "Reading key %s from config file %s", key, config_file);
293 plist_t n = plist_dict_get_item(config, key); 293 plist_t n = plist_dict_get_item(config, key);
294 if (n) { 294 if (n) {
295 *value = plist_copy(n); 295 *value = plist_copy(n);
@@ -371,7 +371,7 @@ void config_get_system_buid(char **system_buid)
371 371
372 if (value && (plist_get_node_type(value) == PLIST_STRING)) { 372 if (value && (plist_get_node_type(value) == PLIST_STRING)) {
373 plist_get_string_val(value, system_buid); 373 plist_get_string_val(value, system_buid);
374 usbmuxd_log(LL_DEBUG, "got %s %s", CONFIG_SYSTEM_BUID_KEY, *system_buid); 374 usbmuxd_log(LL_DEBUG, "Got %s %s", CONFIG_SYSTEM_BUID_KEY, *system_buid);
375 } 375 }
376 376
377 if (value) 377 if (value)
@@ -379,14 +379,14 @@ void config_get_system_buid(char **system_buid)
379 379
380 if (!*system_buid) { 380 if (!*system_buid) {
381 /* no config, generate system_buid */ 381 /* no config, generate system_buid */
382 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);
383 *system_buid = config_generate_system_buid(); 383 *system_buid = config_generate_system_buid();
384 if (!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"); 385 usbmuxd_log(LL_WARNING, "WARNING: Failed to store SystemBUID, this might be a problem");
386 } 386 }
387 } 387 }
388 388
389 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);
390} 390}
391 391
392/** 392/**
@@ -429,7 +429,7 @@ int config_set_device_record(const char *udid, char* record_data, uint64_t recor
429 429
430 /* store file */ 430 /* store file */
431 if (!plist_write_to_filename(plist, device_record_file, PLIST_FORMAT_XML)) { 431 if (!plist_write_to_filename(plist, device_record_file, PLIST_FORMAT_XML)) {
432 usbmuxd_log(LL_DEBUG, "could not open '%s' for writing: %s", device_record_file, strerror(errno)); 432 usbmuxd_log(LL_DEBUG, "Could not open '%s' for writing: %s", device_record_file, strerror(errno));
433 res = -ENOENT; 433 res = -ENOENT;
434 } 434 }
435 free(device_record_file); 435 free(device_record_file);
@@ -464,7 +464,7 @@ int config_get_device_record(const char *udid, char **record_data, uint64_t *rec
464 /* read file */ 464 /* read file */
465 buffer_read_from_filename(device_record_file, record_data, record_size); 465 buffer_read_from_filename(device_record_file, record_data, record_size);
466 if (!*record_data) { 466 if (!*record_data) {
467 usbmuxd_log(LL_ERROR, "%s: failed to read '%s': %s", __func__, device_record_file, strerror(errno)); 467 usbmuxd_log(LL_ERROR, "ERROR: Failed to read '%s': %s", device_record_file, strerror(errno));
468 res = -ENOENT; 468 res = -ENOENT;
469 } 469 }
470 free(device_record_file); 470 free(device_record_file);
@@ -490,7 +490,7 @@ int config_remove_device_record(const char *udid)
490 /* remove file */ 490 /* remove file */
491 if (remove(device_record_file) != 0) { 491 if (remove(device_record_file) != 0) {
492 res = -errno; 492 res = -errno;
493 usbmuxd_log(LL_DEBUG, "could not remove %s: %s", device_record_file, strerror(errno)); 493 usbmuxd_log(LL_DEBUG, "Could not remove %s: %s", device_record_file, strerror(errno));
494 } 494 }
495 495
496 free(device_record_file); 496 free(device_record_file);
@@ -527,6 +527,6 @@ void config_device_record_get_host_id(const char *udid, char **host_id)
527 plist_free(value); 527 plist_free(value);
528 528
529 if (!*host_id) { 529 if (!*host_id) {
530 usbmuxd_log(LL_ERROR, "%s: ERROR couldn't get HostID from pairing record for udid %s", __func__, udid); 530 usbmuxd_log(LL_ERROR, "ERROR: Could not get HostID from pairing record for udid %s", udid);
531 } 531 }
532} 532}