summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2023-09-09 22:56:05 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2023-09-09 22:56:05 -0500
commit93ce8e8489bda4a7ebe5161020c83a68f744481f (patch)
tree7574d867d44877ef496fe3a0c2e49e7b966fb171
parent99c942c90063c73734e56bacaa65f947772d9186 (diff)
downloadfcgiwrap-93ce8e8489bda4a7ebe5161020c83a68f744481f.tar.xz
fcgiwrap-93ce8e8489bda4a7ebe5161020c83a68f744481f.zip
Fix implicit fallthrough false positive, noreturn
With warnings and pedantic mode enabled, `gcc (GCC) 13.2.1` returns an implicit fall through warning. This can be fixed by annotating the error function with NORETURN.
-rw-r--r--fcgiwrap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fcgiwrap.c b/fcgiwrap.c
index b44d8aa..8310284 100644
--- a/fcgiwrap.c
+++ b/fcgiwrap.c
@@ -56,6 +56,12 @@
#define UNIX_PATH_MAX 108
#endif
+#if defined(__GNUC__) || defined(__clang__)
+# define NORETURN __attribute__((__noreturn__))
+#else
+# define NORETURN
+#endif
+
extern char **environ;
static char * const * inherited_environ;
static const char **allowed_programs;
@@ -500,7 +506,7 @@ static bool is_allowed_program(const char *program) {
return false;
}
-static void cgi_error(const char *message, const char *reason, const char *filename)
+static void NORETURN cgi_error(const char *message, const char *reason, const char *filename)
{
printf("Status: %s\r\nContent-Type: text/plain\r\n\r\n%s\r\n",
message, message);