Merge branch 'fwd-0.4.3-fixes'

Forward port fixes from 0.4.3
This commit is contained in:
Raymond Pasco 2016-12-13 12:05:13 -08:00
commit ad598d3aae
2 changed files with 20 additions and 27 deletions

View File

@ -65,17 +65,10 @@ CURLINC=$(shell curl-config --cflags)
CURLLIB=$(shell curl-config --libs) CURLLIB=$(shell curl-config --libs)
RM=rm -f RM=rm -f
ifneq ($(UNAME),FreeBSD)
CC=gcc
CXX=g++
CXXFLAGS=$(CFLAGS)
CLD=g++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS)
else
CC=cc CC=cc
CXX=c++ CXX=c++
CXXFLAGS=$(CFLAGS) CXXFLAGS=$(CFLAGS)
CLD=c++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS) CLD=c++ $(CFLAGS) -L/usr/local/lib $(OPTLOCALLFLAGS) $(OPENSSLLFLAGS)
endif
ifeq ($(OS),osx) ifeq ($(OS),osx)
COSFLAGS=-fno-diagnostics-fixit-info COSFLAGS=-fno-diagnostics-fixit-info
@ -109,7 +102,7 @@ endif
LIBUV_VER=libuv-v1.7.5 LIBUV_VER=libuv-v1.7.5
LIBUV_CONFIGURE_OPTIONS= LIBUV_CONFIGURE_OPTIONS=CC=$(CC)
# NOTFORCHECKIN - restore -O3 # NOTFORCHECKIN - restore -O3
# -DGHETTO \ # -DGHETTO \
@ -139,7 +132,7 @@ CWFLAGS=-Wall \
-Wno-unused-parameter \ -Wno-unused-parameter \
-Wno-missing-field-initializers \ -Wno-missing-field-initializers \
-Wno-strict-aliasing \ -Wno-strict-aliasing \
-Werror -Wno-error
ifneq ($(OS),bsd) ifneq ($(OS),bsd)
CWFLAGS+=-Wno-error=unused-result CWFLAGS+=-Wno-error=unused-result
endif endif

View File

@ -1,6 +1,7 @@
/* v/http.c /* v/http.c
** **
*/ */
#define _WITH_DPRINTF
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
@ -1093,30 +1094,26 @@ _http_start(u3_http* htp_u)
void void
_http_write_ports_file(c3_c *pax_c) _http_write_ports_file(c3_c *pax_c)
{ {
c3_c paf_c[2048]; int pal_i;
FILE *por_u; c3_c *paf_c;
int por_i;
u3_http *htp_u; 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")) ) { por_i = open(paf_c, O_WRONLY | O_CREAT | O_TRUNC, 0666);
fprintf(uH, ".http.ports already existed - clearing it\n"); 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 ) { 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->sec) ? "assumed-secure" : "insecure",
(c3y == htp_u->lop) ? "loopback" : "public"); (c3y == htp_u->lop) ? "loopback" : "public");
} }
{ c3_sync(por_i);
c3_i fid_i = fileno(por_u); close(por_i);
c3_sync(fid_i);
}
fclose(por_u);
} }
/* _http_release_ports_file(): update .http.ports /* _http_release_ports_file(): update .http.ports
@ -1124,9 +1121,12 @@ _http_write_ports_file(c3_c *pax_c)
void void
_http_release_ports_file(c3_c *pax_c) _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); unlink(paf_c);
} }