2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00

Use the fallthrough attribute instead of /* FALLTHROUGH */ comments.

This commit is contained in:
Todd C. Miller 2020-08-01 13:10:50 -06:00
parent 20fd3b6363
commit 03ad96e445
29 changed files with 121 additions and 100 deletions

View File

@ -258,6 +258,9 @@
/* Define to 1 if you have the `faccessat' function. */ /* Define to 1 if you have the `faccessat' function. */
#undef HAVE_FACCESSAT #undef HAVE_FACCESSAT
/* Define to 1 if the compiler supports the fallthrough attribute. */
#undef HAVE_FALLTHROUGH_ATTRIBUTE
/* Define to 1 if you have the `fchmodat' function. */ /* Define to 1 if you have the `fchmodat' function. */
#undef HAVE_FCHMODAT #undef HAVE_FCHMODAT
@ -1038,8 +1041,8 @@
/* Define to 1 if you want sudo to free up memory before exiting. */ /* Define to 1 if you want sudo to free up memory before exiting. */
#undef NO_LEAKS #undef NO_LEAKS
/* Define to 1 if you don't want users to get the lecture the first time they use /* Define to 1 if you don't want users to get the lecture the first time they
sudo. */ use sudo. */
#undef NO_LECTURE #undef NO_LECTURE
/* Define to 1 if you don't want to use sudo's PAM session support. */ /* Define to 1 if you don't want to use sudo's PAM session support. */

28
configure vendored
View File

@ -27861,10 +27861,11 @@ _ACEOF
if test -n "$GCC"; then if test -n "$GCC"; then
if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith" CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith"
_CFLAGS="$CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports the fallthrough attribute" >&5
CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" $as_echo_n "checking whether $CC supports the fallthrough attribute... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler acceptd -Wimplicit-fallthrough" >&5 if ${sudo_cv_var_fallthrough_attribute+:} false; then :
$as_echo_n "checking whether C compiler acceptd -Wimplicit-fallthrough... " >&6; } $as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -27874,7 +27875,7 @@ $as_echo_n "checking whether C compiler acceptd -Wimplicit-fallthrough... " >&6;
switch (num) { switch (num) {
case 1: case 1:
num = 0; num = 0;
/* FALLTHROUGH */ __attribute__((__fallthrough__));
case 0: case 0:
num++; num++;
} }
@ -27884,19 +27885,23 @@ $as_echo_n "checking whether C compiler acceptd -Wimplicit-fallthrough... " >&6;
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 sudo_cv_var_fallthrough_attribute=yes
$as_echo "yes" >&6; }
CFLAGS="$_CFLAGS -Wimplicit-fallthrough"
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 sudo_cv_var_fallthrough_attribute=no
$as_echo "no" >&6; }
CFLAGS="$_CFLAGS"
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_var_fallthrough_attribute" >&5
$as_echo "$sudo_cv_var_fallthrough_attribute" >&6; }
if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
$as_echo "#define HAVE_FALLTHROUGH_ATTRIBUTE 1" >>confdefs.h
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi
fi fi
if test X"$enable_werror" = X"yes"; then if test X"$enable_werror" = X"yes"; then
CFLAGS="${CFLAGS} -Werror" CFLAGS="${CFLAGS} -Werror"
@ -30315,5 +30320,6 @@ fi

View File

@ -4591,36 +4591,41 @@ dnl We add -Wall and -Werror after all tests so they don't cause failures
dnl dnl
if test -n "$GCC"; then if test -n "$GCC"; then
if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then if test X"$enable_warnings" = X"yes" -o X"$with_devel" = X"yes"; then
dnl
dnl Default warnings for development use.
dnl
CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith" CFLAGS="${CFLAGS} -Wall -Wsign-compare -Wpointer-arith"
dnl dnl
dnl Check whether -Wimplicit-fallthrough is available and dnl The fallthrough attribute is supported by gcc 7.0 and clang 10.
dnl recognizes /* FALLTHROUGH */ comments. Clang 10 requires dnl This test relies on AC_LANG_WERROR.
dnl the "fallthrough" attribute which we don't use.
dnl dnl
_CFLAGS="$CFLAGS" AC_CACHE_CHECK([whether $CC supports the fallthrough attribute],
CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" [sudo_cv_var_fallthrough_attribute],
AC_MSG_CHECKING([whether C compiler acceptd -Wimplicit-fallthrough]) [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int num = argc + 1; int num = argc + 1;
switch (num) { switch (num) {
case 1: case 1:
num = 0; num = 0;
/* FALLTHROUGH */ __attribute__((__fallthrough__));
case 0: case 0:
num++; num++;
} }
return num; return num;
} }
]])], [ ]])],
AC_MSG_RESULT([yes]) [
CFLAGS="$_CFLAGS -Wimplicit-fallthrough" sudo_cv_var_fallthrough_attribute=yes
], [ ],
AC_MSG_RESULT([no]) [
CFLAGS="$_CFLAGS" sudo_cv_var_fallthrough_attribute=no]
]) )]
)
if test X"$sudo_cv_var_fallthrough_attribute" = X"yes"; then
AC_DEFINE(HAVE_FALLTHROUGH_ATTRIBUTE)
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi
fi fi
if test X"$enable_werror" = X"yes"; then if test X"$enable_werror" = X"yes"; then
CFLAGS="${CFLAGS} -Werror" CFLAGS="${CFLAGS} -Werror"
@ -4891,6 +4896,7 @@ AH_TEMPLATE(HAVE_OPENSSL, [Define to 1 if you are using OpenSSL's TLS and sha2 f
AH_TEMPLATE(HAVE_GCRYPT, [Define to 1 if you are using gcrypt's sha2 functions.]) AH_TEMPLATE(HAVE_GCRYPT, [Define to 1 if you are using gcrypt's sha2 functions.])
AH_TEMPLATE(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION, [Define to 1 if you have the `SSL_CTX_set_min_proto_version' function or macro.]) AH_TEMPLATE(HAVE_SSL_CTX_SET_MIN_PROTO_VERSION, [Define to 1 if you have the `SSL_CTX_set_min_proto_version' function or macro.])
AH_TEMPLATE(SUDOERS_IOLOG_CLIENT, [Define to 1 to compile support for sudo_logsrvd in the sudoers I/O log plugin.]) AH_TEMPLATE(SUDOERS_IOLOG_CLIENT, [Define to 1 to compile support for sudo_logsrvd in the sudoers I/O log plugin.])
AH_TEMPLATE(HAVE_FALLTHROUGH_ATTRIBUTE, [Define to 1 if the compiler supports the fallthrough attribute.])
dnl dnl
dnl Bits to copy verbatim into config.h.in dnl Bits to copy verbatim into config.h.in

View File

@ -80,6 +80,12 @@
# endif # endif
#endif #endif
#ifdef HAVE_FALLTHROUGH_ATTRIBUTE
# define FALLTHROUGH __attribute__((__fallthrough__))
#else
# define FALLTHROUGH do { } while (0)
#endif
/* /*
* Given the pointer x to the member m of the struct s, return * Given the pointer x to the member m of the struct s, return
* a pointer to the containing structure. * a pointer to the containing structure.

View File

@ -50,13 +50,13 @@ sudo_arc4random_buf(void *buf, size_t n)
switch (m) { switch (m) {
case 4: case 4:
*cp++ = (val >> 24) & 0xff; *cp++ = (val >> 24) & 0xff;
/* FALLTHROUGH */ FALLTHROUGH;
case 3: case 3:
*cp++ = (val >> 16) & 0xff; *cp++ = (val >> 16) & 0xff;
/* FALLTHROUGH */ FALLTHROUGH;
case 2: case 2:
*cp++ = (val >> 8) & 0xff; *cp++ = (val >> 8) & 0xff;
/* FALLTHROUGH */ FALLTHROUGH;
case 1: case 1:
*cp++ = val & 0xff; *cp++ = val & 0xff;
break; break;

View File

@ -304,7 +304,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob,
i--; i--;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case COMMA: case COMMA:
if (i && *pm == COMMA) if (i && *pm == COMMA)
break; break;

View File

@ -535,7 +535,7 @@ reswitch: switch (ch) {
if (width == INT_MIN) if (width == INT_MIN)
goto overflow; goto overflow;
width = -width; width = -width;
/* FALLTHROUGH */ FALLTHROUGH;
case '-': case '-':
flags |= LADJUST; flags |= LADJUST;
goto rflag; goto rflag;
@ -649,7 +649,7 @@ reswitch: switch (ch) {
break; break;
case 'D': case 'D':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'd': case 'd':
case 'i': case 'i':
_umax = SARG(); _umax = SARG();
@ -815,7 +815,7 @@ fp_common:
#endif /* NO_PRINTF_PERCENT_N */ #endif /* NO_PRINTF_PERCENT_N */
case 'O': case 'O':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'o': case 'o':
_umax = UARG(); _umax = UARG();
base = OCT; base = OCT;
@ -875,7 +875,7 @@ fp_common:
break; break;
case 'U': case 'U':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'u': case 'u':
_umax = UARG(); _umax = UARG();
base = DEC; base = DEC;
@ -1276,7 +1276,7 @@ reswitch: switch (ch) {
break; break;
case 'D': case 'D':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'd': case 'd':
case 'i': case 'i':
ADDSARG(); ADDSARG();
@ -1316,7 +1316,7 @@ reswitch: switch (ch) {
#endif /* NO_PRINTF_PERCENT_N */ #endif /* NO_PRINTF_PERCENT_N */
case 'O': case 'O':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'o': case 'o':
ADDUARG(); ADDUARG();
break; break;
@ -1333,7 +1333,7 @@ reswitch: switch (ch) {
break; break;
case 'U': case 'U':
flags |= LONGINT; flags |= LONGINT;
/*FALLTHROUGH*/ FALLTHROUGH;
case 'u': case 'u':
case 'X': case 'X':
case 'x': case 'x':

View File

@ -69,7 +69,7 @@ sudo_strtonumx(const char *str, long long minval, long long maxval, char **endp,
break; break;
case '+': case '+':
ch = *cp++; ch = *cp++;
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
sign = '+'; sign = '+';
break; break;

View File

@ -866,10 +866,10 @@ client_message_completion(struct client_closure *closure)
closure->state = SEND_EXIT; closure->state = SEND_EXIT;
debug_return_bool(fmt_exit_message(closure)); debug_return_bool(fmt_exit_message(closure));
} }
/* FALLTHROUGH */ FALLTHROUGH;
case SEND_RESTART: case SEND_RESTART:
closure->state = SEND_IO; closure->state = SEND_IO;
/* FALLTHROUGH */ FALLTHROUGH;
case SEND_IO: case SEND_IO:
/* fmt_next_iolog() will advance state on EOF. */ /* fmt_next_iolog() will advance state on EOF. */
if (!fmt_next_iolog(closure)) if (!fmt_next_iolog(closure))

View File

@ -43,7 +43,7 @@ _sudo_printf_default(int msg_type, const char *fmt, ...)
switch (msg_type & 0xff) { switch (msg_type & 0xff) {
case SUDO_CONV_ERROR_MSG: case SUDO_CONV_ERROR_MSG:
fp = stderr; fp = stderr;
/* FALLTHROUGH */ FALLTHROUGH;
case SUDO_CONV_INFO_MSG: case SUDO_CONV_INFO_MSG:
va_start(ap, fmt); va_start(ap, fmt);
len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap);

View File

@ -681,7 +681,7 @@ converse(int num_msg, PAM_CONST struct pam_message **msg,
switch (pm->msg_style) { switch (pm->msg_style) {
case PAM_PROMPT_ECHO_ON: case PAM_PROMPT_ECHO_ON:
type = SUDO_CONV_PROMPT_ECHO_ON; type = SUDO_CONV_PROMPT_ECHO_ON;
/* FALLTHROUGH */ FALLTHROUGH;
case PAM_PROMPT_ECHO_OFF: case PAM_PROMPT_ECHO_OFF:
/* Error out if the last password read was interrupted. */ /* Error out if the last password read was interrupted. */
if (getpass_error) if (getpass_error)

View File

@ -121,7 +121,7 @@ check_user_interactive(int validated, int mode, struct getpass_closure *closure)
} }
sudo_debug_printf(SUDO_DEBUG_INFO, sudo_debug_printf(SUDO_DEBUG_INFO,
"%s: check user flag overrides time stamp", __func__); "%s: check user flag overrides time stamp", __func__);
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
/* Bail out if we are non-interactive and a password is required */ /* Bail out if we are non-interactive and a password is required */

View File

@ -277,7 +277,7 @@ print_member_ldif(FILE *fp, struct sudoers_parse_tree *parse_tree, char *name,
print_attribute_ldif(fp, attr_name, negated ? "!ALL" : "ALL"); print_attribute_ldif(fp, attr_name, negated ? "!ALL" : "ALL");
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case COMMAND: case COMMAND:
attr_val = format_cmnd((struct sudo_command *)name, negated); attr_val = format_cmnd((struct sudo_command *)name, negated);
print_attribute_ldif(fp, attr_name, attr_val); print_attribute_ldif(fp, attr_name, attr_val);
@ -292,7 +292,7 @@ print_member_ldif(FILE *fp, struct sudoers_parse_tree *parse_tree, char *name,
alias_put(a); alias_put(a);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
len = asprintf(&attr_val, "%s%s", negated ? "!" : "", name); len = asprintf(&attr_val, "%s%s", negated ? "!" : "", name);
if (len == -1) { if (len == -1) {

View File

@ -218,7 +218,7 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
case T_TUPLE: case T_TUPLE:
if (ISSET(def->type, T_BOOL)) if (ISSET(def->type, T_BOOL))
break; break;
/* FALLTHROUGH */ FALLTHROUGH;
case T_LOGFAC: case T_LOGFAC:
if (op == true) { if (op == true) {
/* Use default syslog facility if none specified. */ /* Use default syslog facility if none specified. */

View File

@ -58,7 +58,7 @@ sudoers_format_member_int(struct sudo_lbuf *lbuf,
sudo_lbuf_append(lbuf, "%sALL", negated ? "!" : ""); sudo_lbuf_append(lbuf, "%sALL", negated ? "!" : "");
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case COMMAND: case COMMAND:
c = (struct sudo_command *) name; c = (struct sudo_command *) name;
TAILQ_FOREACH(digest, &c->digests, entries) { TAILQ_FOREACH(digest, &c->digests, entries) {
@ -100,7 +100,7 @@ sudoers_format_member_int(struct sudo_lbuf *lbuf,
break; break;
} }
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
print_word: print_word:
/* Do not quote UID/GID, all others get quoted. */ /* Do not quote UID/GID, all others get quoted. */

View File

@ -152,7 +152,7 @@ array_to_member_list(void *a, sudo_ldap_iter_t iter)
m->type = ALL; m->type = ALL;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
m->type = WORD; m->type = WORD;
break; break;
@ -222,7 +222,7 @@ host_to_member(char *host)
m->type = ALL; m->type = ALL;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
if (is_address(host)) { if (is_address(host)) {
m->type = NTWKADDR; m->type = NTWKADDR;

View File

@ -98,7 +98,7 @@ user_matches(struct sudoers_parse_tree *parse_tree, const struct passwd *pw,
alias_put(a); alias_put(a);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case WORD: case WORD:
if (userpw_matches(m->name, pw->pw_name, pw)) if (userpw_matches(m->name, pw->pw_name, pw))
matched = !m->negated; matched = !m->negated;
@ -195,7 +195,7 @@ runaslist_matches(struct sudoers_parse_tree *parse_tree,
alias_put(a); alias_put(a);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case WORD: case WORD:
if (userpw_matches(m->name, runas_pw->pw_name, runas_pw)) if (userpw_matches(m->name, runas_pw->pw_name, runas_pw))
user_matched = !m->negated; user_matched = !m->negated;
@ -239,7 +239,7 @@ runaslist_matches(struct sudoers_parse_tree *parse_tree,
alias_put(a); alias_put(a);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case WORD: case WORD:
if (group_matches(m->name, runas_gr)) if (group_matches(m->name, runas_gr))
group_matched = !m->negated; group_matched = !m->negated;
@ -352,7 +352,7 @@ host_matches(struct sudoers_parse_tree *parse_tree, const struct passwd *pw,
alias_put(a); alias_put(a);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case WORD: case WORD:
if (hostname_matches(shost, lhost, m->name)) if (hostname_matches(shost, lhost, m->name))
matched = !m->negated; matched = !m->negated;
@ -399,7 +399,7 @@ cmnd_matches(struct sudoers_parse_tree *parse_tree, const struct member *m)
matched = !m->negated; matched = !m->negated;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case COMMAND: case COMMAND:
c = (struct sudo_command *)m->name; c = (struct sudo_command *)m->name;
if (command_matches(c->cmnd, c->args, &c->digests)) if (command_matches(c->cmnd, c->args, &c->digests))

View File

@ -368,7 +368,7 @@ role_to_sudoers(struct sudoers_parse_tree *parse_tree, struct sudo_role *role,
m->type = ALL; m->type = ALL;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
m->type = WORD; m->type = WORD;
break; break;

View File

@ -514,7 +514,7 @@ sudo_sss_result_get(struct sudo_nss *nss, struct passwd *pw)
break; break;
case ENOMEM: case ENOMEM:
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
sudo_debug_printf(SUDO_DEBUG_ERROR, "handle->fn_send_recv: rc=%d", rc); sudo_debug_printf(SUDO_DEBUG_ERROR, "handle->fn_send_recv: rc=%d", rc);
debug_return_ptr(NULL); debug_return_ptr(NULL);
@ -753,7 +753,7 @@ sudo_sss_getdefs(struct sudo_nss *nss)
break; break;
case ENOMEM: case ENOMEM:
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory")); sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
sudo_debug_printf(SUDO_DEBUG_ERROR, sudo_debug_printf(SUDO_DEBUG_ERROR,
"handle->fn_send_recv_defaults: rc=%d, sss_error=%u", rc, sss_error); "handle->fn_send_recv_defaults: rc=%d, sss_error=%u", rc, sss_error);

View File

@ -48,7 +48,7 @@ sudo_printf_int(int msg_type, const char *fmt, ...)
switch (msg_type & 0xff) { switch (msg_type & 0xff) {
case SUDO_CONV_ERROR_MSG: case SUDO_CONV_ERROR_MSG:
fp = stderr; fp = stderr;
/* FALLTHROUGH */ FALLTHROUGH;
case SUDO_CONV_INFO_MSG: case SUDO_CONV_INFO_MSG:
va_start(ap, fmt); va_start(ap, fmt);
len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap);

View File

@ -448,7 +448,7 @@ getsize_cb(int fd, int what, void *v)
case -1: case -1:
if (errno == EAGAIN) if (errno == EAGAIN)
goto another; goto another;
/* FALLTHROUGH */ FALLTHROUGH;
case 0: case 0:
goto done; goto done;
default: default:
@ -487,7 +487,7 @@ getsize_cb(int fd, int what, void *v)
goto done; goto done;
gc->nums[gc->nums_depth] = 0; gc->nums[gc->nums_depth] = 0;
gc->state = NUMBER; gc->state = NUMBER;
/* FALLTHROUGH */ FALLTHROUGH;
case NUMBER: case NUMBER:
if (!isdigit(ch)) { if (!isdigit(ch)) {
/* done with number, reparse ch */ /* done with number, reparse ch */

View File

@ -367,7 +367,7 @@ ts_init_key(struct timestamp_entry *entry, struct passwd *pw, int flags,
default: default:
/* Unknown time stamp ticket type, treat as tty (should not happen). */ /* Unknown time stamp ticket type, treat as tty (should not happen). */
sudo_warnx("unknown time stamp ticket type %d", ticket_type); sudo_warnx("unknown time stamp ticket type %d", ticket_type);
/* FALLTHROUGH */ FALLTHROUGH;
case tty: case tty:
if (user_ttypath != NULL && stat(user_ttypath, &sb) == 0) { if (user_ttypath != NULL && stat(user_ttypath, &sb) == 0) {
/* tty-based time stamp */ /* tty-based time stamp */
@ -377,7 +377,7 @@ ts_init_key(struct timestamp_entry *entry, struct passwd *pw, int flags,
get_starttime(entry->sid, &entry->start_time); get_starttime(entry->sid, &entry->start_time);
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case kernel: case kernel:
case ppid: case ppid:
/* ppid-based time stamp */ /* ppid-based time stamp */

View File

@ -811,7 +811,7 @@ whatnow(void)
switch (choice) { switch (choice) {
case EOF: case EOF:
choice = 'x'; choice = 'x';
/* FALLTHROUGH */ FALLTHROUGH;
case 'e': case 'e':
case 'x': case 'x':
case 'Q': case 'Q':

View File

@ -64,7 +64,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
goto read_pass; goto read_pass;
case SUDO_CONV_PROMPT_MASK: case SUDO_CONV_PROMPT_MASK:
SET(flags, TGP_MASK); SET(flags, TGP_MASK);
/* FALLTHROUGH */ FALLTHROUGH;
case SUDO_CONV_PROMPT_ECHO_OFF: case SUDO_CONV_PROMPT_ECHO_OFF:
if (ISSET(msg->msg_type, SUDO_CONV_PROMPT_ECHO_OK)) if (ISSET(msg->msg_type, SUDO_CONV_PROMPT_ECHO_OK))
SET(flags, TGP_NOECHO_TRY); SET(flags, TGP_NOECHO_TRY);
@ -84,7 +84,7 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
break; break;
case SUDO_CONV_ERROR_MSG: case SUDO_CONV_ERROR_MSG:
fp = stderr; fp = stderr;
/* FALLTHROUGH */ FALLTHROUGH;
case SUDO_CONV_INFO_MSG: case SUDO_CONV_INFO_MSG:
if (msg->msg != NULL) { if (msg->msg != NULL) {
size_t len = strlen(msg->msg); size_t len = strlen(msg->msg);
@ -172,7 +172,7 @@ sudo_conversation_printf(int msg_type, const char *fmt, ...)
switch (msg_type & 0xff) { switch (msg_type & 0xff) {
case SUDO_CONV_ERROR_MSG: case SUDO_CONV_ERROR_MSG:
fp = stderr; fp = stderr;
/* FALLTHROUGH */ FALLTHROUGH;
case SUDO_CONV_INFO_MSG: case SUDO_CONV_INFO_MSG:
va_start(ap, fmt); va_start(ap, fmt);
len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap); len = vfprintf(ttyfp ? ttyfp : fp, fmt, ap);

View File

@ -201,7 +201,7 @@ mon_handle_sigchld(struct monitor_closure *mc)
switch (pid) { switch (pid) {
case 0: case 0:
errno = ECHILD; errno = ECHILD;
/* FALLTHROUGH */ FALLTHROUGH;
case -1: case -1:
sudo_warn(U_("%s: %s"), __func__, "waitpid"); sudo_warn(U_("%s: %s"), __func__, "waitpid");
debug_return; debug_return;

View File

@ -542,7 +542,7 @@ suspend_sudo(struct exec_closure_pty *ec, int signo)
ret = SIGCONT_FG; /* resume command in foreground */ ret = SIGCONT_FG; /* resume command in foreground */
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case SIGSTOP: case SIGSTOP:
case SIGTSTP: case SIGTSTP:
/* Flush any remaining output and deschedule I/O events. */ /* Flush any remaining output and deschedule I/O events. */
@ -663,7 +663,7 @@ read_callback(int fd, int what, void *v)
/* treat read error as fatal and close the fd */ /* treat read error as fatal and close the fd */
sudo_debug_printf(SUDO_DEBUG_ERROR, sudo_debug_printf(SUDO_DEBUG_ERROR,
"error reading fd %d: %s", fd, strerror(errno)); "error reading fd %d: %s", fd, strerror(errno));
/* FALLTHROUGH */ FALLTHROUGH;
case 0: case 0:
/* got EOF or pty has gone away */ /* got EOF or pty has gone away */
if (n == 0) { if (n == 0) {
@ -763,7 +763,7 @@ write_callback(int fd, int what, void *v)
/* Schedule SIGTTOU to be forwarded to the command. */ /* Schedule SIGTTOU to be forwarded to the command. */
schedule_signal(iob->ec, SIGTTOU); schedule_signal(iob->ec, SIGTTOU);
} }
/* FALLTHROUGH */ FALLTHROUGH;
case EAGAIN: case EAGAIN:
/* not an error */ /* not an error */
break; break;
@ -1041,7 +1041,7 @@ handle_sigchld_pty(struct exec_closure_pty *ec)
switch (pid) { switch (pid) {
case 0: case 0:
errno = ECHILD; errno = ECHILD;
/* FALLTHROUGH */ FALLTHROUGH;
case -1: case -1:
sudo_warn(U_("%s: %s"), __func__, "waitpid"); sudo_warn(U_("%s: %s"), __func__, "waitpid");
debug_return; debug_return;

View File

@ -389,7 +389,7 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv,
valid_flags = 0; valid_flags = 0;
break; break;
} }
/* FALLTHROUGH */ FALLTHROUGH;
case OPT_HOSTNAME: case OPT_HOSTNAME:
assert(optarg != NULL); assert(optarg != NULL);
if (*optarg == '\0') if (*optarg == '\0')

View File

@ -161,7 +161,7 @@ try_wordexp(void)
break; break;
} }
wordfree(&we); wordfree(&we);
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
printf("%s: FAIL (wordexp) [%d]\n", getprogname(), rc); printf("%s: FAIL (wordexp) [%d]\n", getprogname(), rc);
break; break;

View File

@ -435,7 +435,7 @@ getln(int fd, char *buf, size_t bufsiz, bool feedback,
*errval = TGP_ERRVAL_NOPASSWORD; *errval = TGP_ERRVAL_NOPASSWORD;
debug_return_str(NULL); debug_return_str(NULL);
} }
/* FALLTHROUGH */ FALLTHROUGH;
default: default:
debug_return_str_masked(buf); debug_return_str_masked(buf);
} }