Merge branch 'dev' of github.com:flightaware/dump1090 into dev
This commit is contained in:
commit
8c892973be
1
Makefile
1
Makefile
|
|
@ -42,7 +42,6 @@ endif
|
||||||
UNAME := $(shell uname)
|
UNAME := $(shell uname)
|
||||||
|
|
||||||
ifeq ($(UNAME), Linux)
|
ifeq ($(UNAME), Linux)
|
||||||
include Makefile.cpufeatures
|
|
||||||
CPPFLAGS += -D_DEFAULT_SOURCE
|
CPPFLAGS += -D_DEFAULT_SOURCE
|
||||||
LIBS += -lrt
|
LIBS += -lrt
|
||||||
LIBS_USB += -lusb-1.0
|
LIBS_USB += -lusb-1.0
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ DPKG_EXPORT_BUILDFLAGS = 1
|
||||||
include /usr/share/dpkg/default.mk
|
include /usr/share/dpkg/default.mk
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
dh_auto_build -- RTLSDR=yes BLADERF=yes HACKRF=no LIMESDR=no DUMP1090_VERSION=$(DEB_VERSION)
|
# jessie's gcc doesn't support the compiler flags needed for ARM-specific starch flavors;
|
||||||
|
# turn off runtime CPU detection
|
||||||
|
dh_auto_build -- RTLSDR=yes BLADERF=yes HACKRF=no LIMESDR=no DUMP1090_VERSION=$(DEB_VERSION) CPUFEATURES=no
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_install:
|
||||||
dh_install
|
dh_install
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ DPKG_EXPORT_BUILDFLAGS = 1
|
||||||
include /usr/share/dpkg/default.mk
|
include /usr/share/dpkg/default.mk
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
dh_auto_build -- RTLSDR=yes BLADERF=yes HACKRF=no LIMESDR=no DUMP1090_VERSION=$(DEB_VERSION)
|
# starch's gcc doesn't support the compiler flags needed for ARM-specific starch flavors;
|
||||||
|
# turn off runtime CPU detection
|
||||||
|
dh_auto_build -- RTLSDR=yes BLADERF=yes HACKRF=no LIMESDR=no DUMP1090_VERSION=$(DEB_VERSION) CPUFEATURES=no
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_install:
|
||||||
dh_install
|
dh_install
|
||||||
|
|
|
||||||
24
net_io.c
24
net_io.c
|
|
@ -1828,15 +1828,20 @@ static char * appendStatsJson(char *p,
|
||||||
}
|
}
|
||||||
|
|
||||||
char *generateStatsJson(const char *url_path, int *len) {
|
char *generateStatsJson(const char *url_path, int *len) {
|
||||||
const size_t bufsize = 4096;
|
MODES_NOTUSED(url_path);
|
||||||
char *buf = malloc(bufsize), *p = buf, *end = buf + bufsize;
|
|
||||||
if (!buf) {
|
int buflen = 8192;
|
||||||
|
char *buf, *p, *end;
|
||||||
|
|
||||||
|
retry:
|
||||||
|
if (!(buf = malloc(buflen))) {
|
||||||
// allocation failed, give up
|
// allocation failed, give up
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MODES_NOTUSED(url_path);
|
p = buf;
|
||||||
|
end = buf + buflen;
|
||||||
|
|
||||||
p = safe_snprintf(p, end, "{\n");
|
p = safe_snprintf(p, end, "{\n");
|
||||||
p = appendStatsJson(p, end, &Modes.stats_latest, "latest");
|
p = appendStatsJson(p, end, &Modes.stats_latest, "latest");
|
||||||
|
|
@ -1854,12 +1859,15 @@ char *generateStatsJson(const char *url_path, int *len) {
|
||||||
p = appendStatsJson(p, end, &Modes.stats_alltime, "total");
|
p = appendStatsJson(p, end, &Modes.stats_alltime, "total");
|
||||||
p = safe_snprintf(p, end, "\n}\n");
|
p = safe_snprintf(p, end, "\n}\n");
|
||||||
|
|
||||||
if (p <= end) {
|
int used = p - buf;
|
||||||
*len = p-buf;
|
if (p >= end) {
|
||||||
} else {
|
// overran the buffer
|
||||||
*len = 0; // ran out of buffer space, give up
|
buflen = used + 50;
|
||||||
|
free(buf);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*len = used;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue