summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-10-11 23:22:12 +0200
committerGravatar Nikias Bassen2019-10-11 23:22:12 +0200
commit71d65b39f437811d82739f3862fcc92348766dfb (patch)
tree7ea504f73c74b9b39792cfbbbd065f883298493d
parent2805c31c3c1427cb6535982b244e9bfeb28e9221 (diff)
downloadidevicerestore-71d65b39f437811d82739f3862fcc92348766dfb.tar.gz
idevicerestore-71d65b39f437811d82739f3862fcc92348766dfb.tar.bz2
Don't try to print a NULL udid in device event debug message and use working format specifier for win32
-rw-r--r--src/common.h2
-rw-r--r--src/idevicerestore.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/common.h b/src/common.h
index 87ceaaf..dbd2a41 100644
--- a/src/common.h
+++ b/src/common.h
@@ -131,6 +131,7 @@ char *generate_guid(void);
#include <unistd.h>
#define __mkdir(path, mode) mkdir(path)
#define FMT_qu "%I64u"
+#define FMT_016llx "%016I64x"
#ifndef sleep
#define sleep(x) Sleep(x*1000)
#endif
@@ -139,6 +140,7 @@ char *generate_guid(void);
#include <sys/stat.h>
#define __mkdir(path, mode) mkdir(path, mode)
#define FMT_qu "%qu"
+#define FMT_016llx "%016llx"
#define __usleep(x) usleep(x)
#endif
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 7c02eda..d7f2a85 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -211,13 +211,13 @@ static void idevice_event_cb(const idevice_event_t *event, void *userdata)
if (normal_check_mode(client) == 0) {
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_NORMAL];
- debug("%s: device %016llx (udid: %s) connected in normal mode\n", __func__, client->ecid, client->udid);
+ debug("%s: device " FMT_016llx " (udid: %s) connected in normal mode\n", __func__, client->ecid, client->udid);
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
} else if (client->ecid && restore_check_mode(client) == 0) {
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_RESTORE];
- debug("%s: device %016llx (udid: %s) connected in restore mode\n", __func__, client->ecid, client->udid);
+ debug("%s: device " FMT_016llx " (udid: %s) connected in restore mode\n", __func__, client->ecid, client->udid);
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
}
@@ -225,7 +225,7 @@ static void idevice_event_cb(const idevice_event_t *event, void *userdata)
if (client->udid && !strcmp(event->udid, client->udid)) {
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_UNKNOWN];
- debug("%s: device %016llx (udid: %s) disconnected\n", __func__, client->ecid, client->udid);
+ debug("%s: device " FMT_016llx " (udid: %s) disconnected\n", __func__, client->ecid, client->udid);
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
}
@@ -257,7 +257,7 @@ static void irecv_event_cb(const irecv_device_event_t* event, void *userdata)
default:
client->mode = &idevicerestore_modes[MODE_UNKNOWN];
}
- debug("%s: device %016llx (udid: %s) connected in %s mode\n", __func__, client->ecid, client->udid, client->mode->string);
+ debug("%s: device " FMT_016llx " (udid: %s) connected in %s mode\n", __func__, client->ecid, (client->udid) ? client->udid : "N/A", client->mode->string);
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
}
@@ -265,7 +265,7 @@ static void irecv_event_cb(const irecv_device_event_t* event, void *userdata)
if (client->ecid && event->device_info->ecid == client->ecid) {
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_UNKNOWN];
- debug("%s: device %016llx (udid: %s) disconnected\n", __func__, client->ecid, client->udid);
+ debug("%s: device " FMT_016llx " (udid: %s) disconnected\n", __func__, client->ecid, (client->udid) ? client->udid : "N/A");
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
}