summaryrefslogtreecommitdiffstats
path: root/tools/idevicedate.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-11-29 03:42:06 +0100
committerGravatar Nikias Bassen2012-11-29 03:42:06 +0100
commit36c0192fbb16d068214d2640aecfb731ea24bfaa (patch)
tree4596eb003c5f074c4ca0b9e1e146680927916d11 /tools/idevicedate.c
parentd2b82f9a8330a995a3e913adf734ac2b9ece9916 (diff)
downloadlibimobiledevice-36c0192fbb16d068214d2640aecfb731ea24bfaa.tar.gz
libimobiledevice-36c0192fbb16d068214d2640aecfb731ea24bfaa.tar.bz2
tools: use pointer instead of static buffer for UDID since it can start with '0'
Diffstat (limited to 'tools/idevicedate.c')
-rw-r--r--tools/idevicedate.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index 9de6ed0..19f7c1d 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -57,10 +57,9 @@ int main(int argc, char *argv[])
idevice_t phone = NULL;
idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
- char udid[41];
+ const char* udid = NULL;
time_t setdate = 0;
plist_t node = NULL;
- udid[0] = 0;
uint64_t datetime = 0;
time_t rawtime;
struct tm * tmp;
@@ -79,7 +78,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
- strcpy(udid, argv[i]);
+ udid = argv[i];
continue;
}
else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) {
@@ -124,20 +123,14 @@ int main(int argc, char *argv[])
}
}
- if (udid[0] != 0) {
- ret = idevice_new(&phone, udid);
- if (ret != IDEVICE_E_SUCCESS) {
+ ret = idevice_new(&phone, udid);
+ if (ret != IDEVICE_E_SUCCESS) {
+ if (udid) {
printf("No device found with udid %s, is it plugged in?\n", udid);
- return -1;
- }
- }
- else
- {
- ret = idevice_new(&phone, NULL);
- if (ret != IDEVICE_E_SUCCESS) {
+ } else {
printf("No device found, is it plugged in?\n");
- return -1;
}
+ return -1;
}
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicedate")) {