From ade4dedb5f0d69122a5c742aa96c8bd150dab9a7 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 1 Jul 2009 18:17:16 +0200 Subject: Fix segfault when displaying usage for installed iphoneinfo and iphonesyslog [#54 state:resolved] Signed-off-by: Matt Colyer --- dev/iphoneinfo.c | 5 ++++- dev/syslog_relay.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dev/iphoneinfo.c b/dev/iphoneinfo.c index 641b47d..18ee055 100644 --- a/dev/iphoneinfo.c +++ b/dev/iphoneinfo.c @@ -158,7 +158,10 @@ int is_domain_known(char *domain) void print_usage(int argc, char **argv) { int i = 0; - printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); + char *name = NULL; + + name = strrchr(argv[0], '/'); + printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); printf("Show information about the first connected iPhone/iPod Touch.\n\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c index e552e9c..6698653 100644 --- a/dev/syslog_relay.c +++ b/dev/syslog_relay.c @@ -154,7 +154,10 @@ int main(int argc, char *argv[]) void print_usage(int argc, char **argv) { - printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); + char *name = NULL; + + name = strrchr(argv[0], '/'); + printf("Usage: %s [OPTIONS]\n", (name ? name + 1: argv[0])); printf("Relay syslog of a connected iPhone/iPod Touch.\n\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); -- cgit v1.1-32-gdbae