From 191186a39cd3d31235f43db63c94d1b206131f1d Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 6 Aug 2014 23:11:38 +0200 Subject: userpref: Fix wrong documentation about return values of userpref_read_system_buid() Also, add a debug message that will print the actual error code. --- common/userpref.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/common/userpref.c b/common/userpref.c index 8076287..fd7022c 100644 --- a/common/userpref.c +++ b/common/userpref.c @@ -173,18 +173,21 @@ const char *userpref_get_config_dir() } /** - * Reads the BUID from a previously generated configuration file. + * Reads the SystemBUID from a previously generated configuration file. * - * @note It is the responsibility of the calling function to free the returned system_buid - * @param system_buid A null terminated string containing a valid SystemBUID. - * @return 1 if the system buid could be retrieved or 0 otherwise. + * @note It is the responsibility of the calling function to free the returned system_buid. + * @param system_buid A pointer that will be set to a newly allocated string containing the + * SystemBUID upon successful return. + * @return 0 if the SystemBUID has been successfully retrieved or < 0 otherwise. */ int userpref_read_system_buid(char **system_buid) { int res = usbmuxd_read_buid(system_buid); - - debug_info("using %s as %s", *system_buid, USERPREF_SYSTEM_BUID_KEY); - + if (res == 0) { + debug_info("using %s as %s", *system_buid, USERPREF_SYSTEM_BUID_KEY); + } else { + debug_info("could not read system buid, error %d", res); + } return res; } -- cgit v1.1-32-gdbae