diff options
Diffstat (limited to 'common/recipes-applications/rtc-test/files/rtc-test.c')
-rw-r--r-- | common/recipes-applications/rtc-test/files/rtc-test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/recipes-applications/rtc-test/files/rtc-test.c b/common/recipes-applications/rtc-test/files/rtc-test.c index 08088544..3411e4c8 100644 --- a/common/recipes-applications/rtc-test/files/rtc-test.c +++ b/common/recipes-applications/rtc-test/files/rtc-test.c @@ -182,7 +182,11 @@ void parse_cmd(const char *cmdline) struct rtc_time rtc_time; struct rtc_wkalrm rtc_wakealarm; - if (strncmp(cmdline, "help", 4) == 0) + if ((cmdline == NULL) || (strncmp(cmdline, "exit", 4) == 0)) { + close(rtc_fd); + printf("\nExiting...\n"); + exit(EXIT_SUCCESS); + } else if (strncmp(cmdline, "help", 4) == 0) print_usage(); else if (strncmp(cmdline, "updateinton", 11) == 0) { int i; @@ -453,10 +457,6 @@ void parse_cmd(const char *cmdline) perror("RTC_PIE_OFF ioctl"); } else if (strncmp(cmdline, "license", 7) == 0) { show_license(); - } else if (strncmp(cmdline, "exit", 4) == 0) { - close(rtc_fd); - printf("\nExiting...\n"); - exit(EXIT_SUCCESS); } else { printf("\nUnknown command\n"); print_usage(); |