diff --git a/src/common.c b/src/common.c index f8719df..b965ac9 100644 --- a/src/common.c +++ b/src/common.c @@ -101,18 +101,16 @@ int setgroups(int count, int *groups) } #endif - -void -check_superuser(void (*usage_fn)(void)) -{ #ifndef WINDOWS32 +void +check_superuser(void) +{ if (geteuid() != 0) { warnx("Run as root and you'll be happy.\n"); - usage_fn(); - /* NOTREACHED */ + exit(-1); } -#endif } +#endif char * format_addr(struct sockaddr_storage *sockaddr, int sockaddr_len) diff --git a/src/common.h b/src/common.h index 2de23e9..5f2c7ad 100644 --- a/src/common.h +++ b/src/common.h @@ -102,7 +102,13 @@ enum connection { CONN_MAX }; -void check_superuser(void (*usage_fn)(void)); +#ifdef WINDOWS32 +static inline void check_superuser(void) +{ +} +#else +void check_superuser(void); +#endif char *format_addr(struct sockaddr_storage *sockaddr, int sockaddr_len); int get_addr(char *, int, int, int, struct sockaddr_storage *); int open_dns(struct sockaddr_storage *, size_t); diff --git a/src/iodine.c b/src/iodine.c index 2599a6d..5c74ddc 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -275,7 +275,7 @@ main(int argc, char **argv) } } - check_superuser(usage); + check_superuser(); argc -= optind; argv += optind; diff --git a/src/iodined.c b/src/iodined.c index c213ec6..8a885d9 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -2537,7 +2537,7 @@ main(int argc, char **argv) argc -= optind; argv += optind; - check_superuser(usage); + check_superuser(); if (argc != 2) usage();