Mark functions not returning as sudo_noreturn
We also put NOTREACHED where it applies.
This commit is contained in:
@@ -614,6 +614,7 @@ exec_monitor(struct command_details *details, sigset_t *oset,
|
||||
if (write(errpipe[1], &errno, sizeof(int)) == -1)
|
||||
sudo_warn(U_("unable to execute %s"), details->command);
|
||||
_exit(EXIT_FAILURE);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
close(errpipe[1]);
|
||||
if (intercept_fd != -1)
|
||||
@@ -702,6 +703,7 @@ exec_monitor(struct command_details *details, sigset_t *oset,
|
||||
#endif
|
||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1);
|
||||
_exit(EXIT_FAILURE);
|
||||
/* NOTREACHED */
|
||||
|
||||
bad:
|
||||
debug_return_int(-1);
|
||||
|
@@ -633,6 +633,7 @@ exec_nopty(struct command_details *details,
|
||||
}
|
||||
sudo_debug_exit_int(__func__, __FILE__, __LINE__, sudo_debug_subsys, 1);
|
||||
_exit(EXIT_FAILURE);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO, "executed %s, pid %d", details->command,
|
||||
(int)ec.cmnd_pid);
|
||||
|
@@ -1333,6 +1333,7 @@ exec_pty(struct command_details *details,
|
||||
"%s: unable to send status to parent", __func__);
|
||||
}
|
||||
_exit(EXIT_FAILURE);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -148,6 +148,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
|
15
src/sudo.c
15
src/sudo.c
@@ -1118,7 +1118,7 @@ format_plugin_settings(struct plugin_container *plugin)
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
plugin_settings[i + 1] = NULL;
|
||||
plugin_settings[++i] = NULL;
|
||||
|
||||
/* Add to list of vectors to be garbage collected at exit. */
|
||||
if (!gc_add(GC_VECTOR, plugin_settings))
|
||||
@@ -1167,12 +1167,10 @@ policy_open(void)
|
||||
sudo_debug_set_active_instance(sudo_debug_instance);
|
||||
|
||||
if (ok != 1) {
|
||||
if (ok == -2)
|
||||
if (ok == -2)
|
||||
usage();
|
||||
else {
|
||||
/* XXX - audit */
|
||||
sudo_fatalx("%s", U_("unable to initialize policy plugin"));
|
||||
}
|
||||
}
|
||||
|
||||
debug_return;
|
||||
@@ -1258,7 +1256,7 @@ policy_check(int argc, char * const argv[], char *env_add[],
|
||||
break;
|
||||
case -2:
|
||||
usage();
|
||||
break;
|
||||
/* NOTREACHED */
|
||||
}
|
||||
debug_return_bool(false);
|
||||
}
|
||||
@@ -1488,7 +1486,7 @@ iolog_open(char * const command_info[], int argc, char * const argv[],
|
||||
break;
|
||||
case -2:
|
||||
usage();
|
||||
break;
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
sudo_warnx(U_("error initializing I/O plugin %s"),
|
||||
plugin->name);
|
||||
@@ -1639,7 +1637,7 @@ audit_open(void)
|
||||
break;
|
||||
case -2:
|
||||
usage();
|
||||
break;
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
/* TODO: pass error message to other audit plugins */
|
||||
sudo_fatalx(U_("error initializing audit plugin %s"),
|
||||
@@ -1852,7 +1850,7 @@ approval_open_int(struct plugin_container *plugin)
|
||||
break;
|
||||
case -2:
|
||||
usage();
|
||||
break;
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
/* XXX - audit */
|
||||
sudo_fatalx(U_("error initializing approval plugin %s"),
|
||||
@@ -1940,7 +1938,6 @@ approval_check(char * const command_info[], char * const run_argv[],
|
||||
break;
|
||||
case -2:
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Close approval plugin now that errstr has been consumed. */
|
||||
|
Reference in New Issue
Block a user