fix: initialize uri also when query is empty - gopherproxy-c - Gopher HTTP proxy in C (CGI)
(HTM) git clone git://git.codemadness.org/gopherproxy-c
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2922b5f38556aacf5dd1c6928b34be60a07cec7b
(DIR) parent 37d95c874eab8ad35bd95ad3381405310934cd08
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 17 Aug 2018 12:50:40 +0200
fix: initialize uri also when query is empty
+ minor code-style.
Diffstat:
M gopherproxy.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/gopherproxy.c b/gopherproxy.c
@@ -168,8 +168,7 @@ servefile(const char *server, const char *port, const char *path)
if (pledge("stdio", NULL) == -1)
die(500, "pledge: %s\n", strerror(errno));
- w = dprintf(fd, "%s\r\n", path);
- if (w == -1)
+ if ((w = dprintf(fd, "%s\r\n", path)) == -1)
die(500, "dprintf: %s\n", strerror(errno));
while ((r = read(fd, buf, sizeof(buf))) > 0) {
@@ -450,7 +449,7 @@ int
main(void)
{
struct uri u;
- const char *p, *qs, *path, *uri;
+ const char *p, *qs, *path, *uri = "";
char query[1024] = "", param[1024] = "";
int _type = '1';