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)
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 \
@ -139,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

View File

@ -1,6 +1,7 @@
/* v/http.c
**
*/
#define _WITH_DPRINTF
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@ -1093,30 +1094,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 +1121,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);
}