From b22c1f680e7b7266604337b6e2fe501e6a6d5c56 Mon Sep 17 00:00:00 2001 From: xiangfu Date: Thu, 30 Apr 2009 17:31:02 +0000 Subject: [PATCH] make the -v -h work with normal user --- flash-tool/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flash-tool/main.c b/flash-tool/main.c index 1aee3d1..d913d02 100644 --- a/flash-tool/main.c +++ b/flash-tool/main.c @@ -60,17 +60,6 @@ int main(int argc, char **argv) printf("inflash - (C) 2009\n" "This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n"); - if ((getuid()) || (getgid())) { - fprintf(stderr, "Error - you must be root to run '%s'\n", argv[0]); - return EXIT_FAILURE; - } - - if (usb_ingenic_init(&ingenic_dev) < 1) - return EXIT_FAILURE; - - if (parse_configure(&hand, CONFIG_FILE_PATH) < 1) - return EXIT_FAILURE; - while (1) { int c, option_index = 0; c = getopt_long(argc, argv, "hv", opts, @@ -91,9 +80,20 @@ int main(int argc, char **argv) } } + if ((getuid()) || (getgid())) { + fprintf(stderr, "Error - you must be root to run '%s'\n", argv[0]); + return EXIT_FAILURE; + } + + if (usb_ingenic_init(&ingenic_dev) < 1) + return EXIT_FAILURE; + + if (parse_configure(&hand, CONFIG_FILE_PATH) < 1) + return EXIT_FAILURE; + char com_buf[256]; printf("\n Welcome!"); - printf("\n USB Boot Host Software!"); + printf("\n Ingenic Tools Software!"); while (1) { printf("\n inflash :> ");