Suppress two warnings when compiling with tcc

While there, add some comments to better understand the code flow in
localcgi_post().
This commit is contained in:
Rene Kita
2021-10-09 12:11:46 +02:00
parent f7601b4555
commit 89295504fc
2 changed files with 13 additions and 1 deletions

View File

@@ -380,17 +380,19 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
cgi_dir = mydirname(file); cgi_dir = mydirname(file);
#endif #endif
cgi_basename = mybasename(file); 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 */ /* Don't invoke gc after here, or the program might crash in some platforms */
if (pid < 0) { if (pid < 0) {
if (fw) if (fw)
fclose(fw); fclose(fw);
return NULL; return NULL;
} else if (pid) { } else if (pid) {
/* parent */
if (fw) if (fw)
fclose(fw); fclose(fw);
return fr; return fr;
} }
/* child */
setup_child(TRUE, 2, fw ? fileno(fw) : -1); setup_child(TRUE, 2, fw ? fileno(fw) : -1);
set_cgi_environ(name, file, uri); 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)); file, cgi_basename, strerror(errno));
exit(1); exit(1);
#endif #endif
/*
* Suppress compiler warning: function might return no value
* This code is never reached.
*/
return NULL;
} }

5
main.c
View File

@@ -394,6 +394,11 @@ die_oom(size_t bytes)
{ {
fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes); fprintf(stderr, "Out of memory: %lu bytes unavailable!\n", (unsigned long)bytes);
exit(1); exit(1);
/*
* Suppress compiler warning: function might return no value
* This code is never reached.
*/
return NULL;
} }
int int