diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-12-31 10:51:15 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-12-31 10:51:15 +0000 |
commit | a2fe0e2b0a4d010adca30692349eba608f80b502 (patch) | |
tree | dc8466e4941ab50185f604048f1a4e2a9fb03bc5 /dumpcap.c | |
parent | ad692841a8261932b40a45fe1015bea5e4b6d7cd (diff) |
add the GCC specific attribute "noreturn" to exit_main()
add an error message if no interfaces could be found (and mention that it might be a privilege problem)
svn path=/trunk/; revision=16924
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -210,8 +210,12 @@ BOOL WINAPI ConsoleCtrlHandlerRoutine(DWORD dwCtrlType) } #endif -void -exit_main(int err) { +#if __GNUC__ >= 2 +void exit_main(int err) __attribute__ ((noreturn)); +#else +void exit_main(int err) +#endif +{ #ifdef _WIN32 /* Shutdown windows sockets */ WSACleanup(); @@ -353,7 +357,7 @@ main(int argc, char *argv[]) /*** all non capture option specific ***/ case 'D': /* Print a list of capture devices and exit */ capture_opts_list_interfaces(); - exit(0); + exit_main(0); break; case 'L': /* Print list of link-layer types and exit */ list_link_layer_types = TRUE; @@ -416,6 +420,7 @@ main(int argc, char *argv[]) } if (capture_opts_trim_iface(capture_opts, NULL) == FALSE) { + cmdarg_err("No capture interfaces available (maybe lack of privileges?)."); exit_main(1); } @@ -444,8 +449,6 @@ main(int argc, char *argv[]) /* capture failed */ exit_main(1); } - - return 0; /* Everything to keep GCC happy */ } #ifdef _WIN32 |