Mark functions not returning as sudo_noreturn

We also put NOTREACHED where it applies.
This commit is contained in:
Rose
2023-07-01 14:04:22 -04:00
parent 97e574091a
commit 45fdfa18f1
24 changed files with 47 additions and 35 deletions

View File

@@ -406,6 +406,7 @@ send_mail(const struct eventlog *evlog, const char *message)
strerror(errno));
sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
_exit(EXIT_FAILURE);
/* NOTREACHED */
case 0:
/* Grandchild continues below. */
sudo_debug_enter(__func__, __FILE__, __LINE__, sudo_debug_subsys);
@@ -413,6 +414,7 @@ send_mail(const struct eventlog *evlog, const char *message)
default:
/* Parent will wait for us. */
_exit(EXIT_SUCCESS);
/* NOTREACHED */
}
break;
default:
@@ -472,7 +474,7 @@ send_mail(const struct eventlog *evlog, const char *message)
"unable to fork");
sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
_exit(EXIT_FAILURE);
/* NOTREACHED */
/* NOTREACHED */
case 0:
/* Child. */
exec_mailer(pfd[0]);

View File

@@ -35,7 +35,7 @@
sudo_dso_public int main(int argc, char *argv[]);
static void
sudo_noreturn static void
usage(void)
{
fprintf(stderr, "usage: %s [-cv] input_file ...\n",
@@ -100,6 +100,7 @@ main(int argc, char *argv[])
break;
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;

View File

@@ -34,7 +34,7 @@
sudo_dso_public int main(int argc, char *argv[]);
static void
sudo_noreturn static void
usage(void)
{
fprintf(stderr, "usage: %s [-cv] input_file ...\n",
@@ -99,6 +99,7 @@ main(int argc, char *argv[])
break;
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;

View File

@@ -34,7 +34,7 @@
sudo_dso_public int main(int argc, char *argv[]);
static void
sudo_noreturn static void
usage(void)
{
fprintf(stderr, "usage: %s [-v] inputfile\n", getprogname());
@@ -59,6 +59,7 @@ main(int argc, char *argv[])
break;
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;
@@ -110,7 +111,7 @@ main(int argc, char *argv[])
if (len == 0)
printf("# word wrap disabled\n");
else
printf("# word wrap at %d characters\n", (int)len);
printf("# word wrap at %zu characters\n", len);
eventlog_writeln(stdout, lines[0], strlen(lines[0]), len);
len++;
}

View File

@@ -121,7 +121,7 @@ done:
return ret;
}
static void
sudo_noreturn static void
usage(void)
{
fprintf(stderr, "usage: %s [-cv] input_file ...\n",