From 89295504fcc3b9d76813c9de092a6ce97bb575d5 Mon Sep 17 00:00:00 2001 From: Rene Kita Date: Sat, 9 Oct 2021 12:11:46 +0200 Subject: [PATCH] Suppress two warnings when compiling with tcc While there, add some comments to better understand the code flow in localcgi_post(). --- local.c | 9 ++++++++- main.c | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/local.c b/local.c index 8cae710..a0a5c40 100644 --- a/local.c +++ b/local.c @@ -380,17 +380,19 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) cgi_dir = mydirname(file); #endif cgi_basename = mybasename(file); - pid = open_pipe_rw(&fr, NULL); + pid = open_pipe_rw(&fr, NULL); /* open_pipe_rw() forks */ /* Don't invoke gc after here, or the program might crash in some platforms */ if (pid < 0) { if (fw) fclose(fw); return NULL; } else if (pid) { + /* parent */ if (fw) fclose(fw); return fr; } + /* child */ setup_child(TRUE, 2, fw ? fileno(fw) : -1); set_cgi_environ(name, file, uri); @@ -433,4 +435,9 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) file, cgi_basename, strerror(errno)); exit(1); #endif + /* + * Suppress compiler warning: function might return no value + * This code is never reached. + */ + return NULL; } diff --git a/main.c b/main.c index ced6f40..49d7afe 100644 --- a/main.c +++ b/main.c @@ -394,6 +394,11 @@ die_oom(size_t bytes) { fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes); exit(1); + /* + * Suppress compiler warning: function might return no value + * This code is never reached. + */ + return NULL; } int