Added notreached

This commit is contained in:
Erik Ekman 2008-12-11 19:11:53 +00:00
parent c7d1620cad
commit a83164fad8

View File

@ -720,12 +720,14 @@ main(int argc, char **argv)
switch(choice) { switch(choice) {
case 'v': case 'v':
version(); version();
/* NOTREACHED */
break; break;
case 'f': case 'f':
foreground = 1; foreground = 1;
break; break;
case 'h': case 'h':
help(); help();
/* NOTREACHED */
break; break;
case 'u': case 'u':
username = optarg; username = optarg;
@ -752,6 +754,7 @@ main(int argc, char **argv)
if (geteuid() != 0) { if (geteuid() != 0) {
warnx("Run as root and you'll be happy.\n"); warnx("Run as root and you'll be happy.\n");
usage(); usage();
/* NOTREACHED */
} }
argc -= optind; argc -= optind;
@ -777,16 +780,19 @@ main(int argc, char **argv)
if(check_topdomain(topdomain)) { if(check_topdomain(topdomain)) {
warnx("Topdomain contains invalid characters.\n"); warnx("Topdomain contains invalid characters.\n");
usage(); usage();
/* NOTREACHED */
} }
} else { } else {
warnx("Use a topdomain max 128 chars long.\n"); warnx("Use a topdomain max 128 chars long.\n");
usage(); usage();
/* NOTREACHED */
} }
if (username != NULL) { if (username != NULL) {
if ((pw = getpwnam(username)) == NULL) { if ((pw = getpwnam(username)) == NULL) {
warnx("User %s does not exist!\n", username); warnx("User %s does not exist!\n", username);
usage(); usage();
/* NOTREACHED */
} }
} }
@ -818,6 +824,7 @@ main(int argc, char **argv)
if (setgroups(1, gids) < 0 || setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) { if (setgroups(1, gids) < 0 || setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
warnx("Could not switch to user %s!\n", username); warnx("Could not switch to user %s!\n", username);
usage(); usage();
/* NOTREACHED */
} }
} }