From d8c44e673c5802ced848644dc51c06d34e94b66b Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Tue, 13 Dec 2016 05:31:33 -0800 Subject: [PATCH 1/4] _http_write_ports_file(): remove indirect C malloc --- vere/http.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/vere/http.c b/vere/http.c index a01d7cff22..2fb250779d 100644 --- a/vere/http.c +++ b/vere/http.c @@ -1093,30 +1093,26 @@ _http_start(u3_http* htp_u) void _http_write_ports_file(c3_c *pax_c) { - c3_c paf_c[2048]; - FILE *por_u; + int pal_i; + c3_c *paf_c; + int por_i; u3_http *htp_u; - snprintf(paf_c, 2048, "%s/%s", pax_c, ".http.ports"); + pal_i = strlen(pax_c) + 13; /* includes NUL */ + paf_c = u3a_malloc(pal_i); + snprintf(paf_c, pal_i, "%s/%s", pax_c, ".http.ports"); - if ( NULL != (por_u = fopen(paf_c, "r")) ) { - fprintf(uH, ".http.ports already existed - clearing it\n"); - } + por_i = open(paf_c, O_WRONLY | O_CREAT | O_TRUNC, 0666); + u3a_free(paf_c); - fclose(por_u); - - por_u = fopen(paf_c, "w"); for ( htp_u = u3_Host.htp_u; htp_u; htp_u = htp_u->nex_u ) { - fprintf(por_u, "%u %s %s\n", htp_u->por_w, + dprintf(por_i, "%u %s %s\n", htp_u->por_w, (c3y == htp_u->sec) ? "assumed-secure" : "insecure", (c3y == htp_u->lop) ? "loopback" : "public"); - } + } - { - c3_i fid_i = fileno(por_u); - c3_sync(fid_i); - } - fclose(por_u); + c3_sync(por_i); + close(por_i); } /* _http_release_ports_file(): update .http.ports @@ -1124,9 +1120,12 @@ _http_write_ports_file(c3_c *pax_c) void _http_release_ports_file(c3_c *pax_c) { - c3_c paf_c[2048]; + int pal_i; + c3_c *paf_c; - snprintf(paf_c, 2048, "%s/%s", pax_c, ".http.ports"); + pal_i = strlen(pax_c) + 13; /* includes NUL */ + paf_c = u3a_malloc(pal_i); + snprintf(paf_c, pal_i, "%s/%s", pax_c, ".http.ports"); unlink(paf_c); } From 6598dd88d8bbcfb95f962cb8bf56c225cf68f366 Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Tue, 13 Dec 2016 05:43:53 -0800 Subject: [PATCH 2/4] #define _WITH_DPRINTF for BSD systems --- vere/http.c | 1 + 1 file changed, 1 insertion(+) diff --git a/vere/http.c b/vere/http.c index 2fb250779d..01fda23f50 100644 --- a/vere/http.c +++ b/vere/http.c @@ -1,6 +1,7 @@ /* v/http.c ** */ +#define _WITH_DPRINTF #include #include #include From 8d108b72d452864f5b3cfe7d900c79840694efb1 Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Tue, 13 Dec 2016 07:47:05 -0800 Subject: [PATCH 3/4] Use system C compiler on all platforms --- Makefile | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2fb42d5910..7beaa166e9 100644 --- a/Makefile +++ b/Makefile @@ -65,17 +65,10 @@ CURLINC=$(shell curl-config --cflags) CURLLIB=$(shell curl-config --libs) RM=rm -f -ifneq ($(UNAME),FreeBSD) -CC=gcc -CXX=g++ -CXXFLAGS=$(CFLAGS) -CLD=g++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS) -else CC=cc CXX=c++ CXXFLAGS=$(CFLAGS) CLD=c++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS) -endif ifeq ($(OS),osx) COSFLAGS=-fno-diagnostics-fixit-info @@ -109,7 +102,7 @@ endif LIBUV_VER=libuv-v1.7.5 -LIBUV_CONFIGURE_OPTIONS= +LIBUV_CONFIGURE_OPTIONS=CC=$(CC) # NOTFORCHECKIN - restore -O3 # -DGHETTO \ From cc247229fae692bc56e865087dfec573d1b9da8d Mon Sep 17 00:00:00 2001 From: Raymond Pasco Date: Tue, 13 Dec 2016 07:49:16 -0800 Subject: [PATCH 4/4] No -Werror on release branch (real version scaffolding pending for master) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7beaa166e9..c8001dd9f7 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ CWFLAGS=-Wall \ -Wno-unused-parameter \ -Wno-missing-field-initializers \ -Wno-strict-aliasing \ - -Werror + -Wno-error ifneq ($(OS),bsd) CWFLAGS+=-Wno-error=unused-result endif