Lines 5494-5505
static int ntop_network_prefix(lua_State* vm) {
Link Here
|
5494 |
|
5494 |
|
5495 |
/* ****************************************** */ |
5495 |
/* ****************************************** */ |
5496 |
|
5496 |
|
5497 |
static const char **make_argv(lua_State * vm, int *argc_out, u_int offset, int extra_args) { |
5497 |
static char **make_argv(lua_State * vm, int *argc_out, u_int offset, int extra_args) { |
5498 |
const char **argv; |
5498 |
char **argv; |
5499 |
int i; |
5499 |
int i; |
5500 |
int argc = lua_gettop(vm) + 1 - offset + extra_args; |
5500 |
int argc = lua_gettop(vm) + 1 - offset + extra_args; |
5501 |
|
5501 |
|
5502 |
if(!(argv = (const char**)calloc(argc, sizeof (char *)))) |
5502 |
if(!(argv = (char**)calloc(argc, sizeof (char *)))) |
5503 |
/* raise an error and never return */ |
5503 |
/* raise an error and never return */ |
5504 |
luaL_error(vm, "Can't allocate memory for arguments array"); |
5504 |
luaL_error(vm, "Can't allocate memory for arguments array"); |
5505 |
|
5505 |
|
Lines 5535-5541
static const char **make_argv(lua_State * vm, int *argc_out, u_int offset, int e
Link Here
|
5535 |
static int ntop_rrd_create(lua_State* vm) { |
5535 |
static int ntop_rrd_create(lua_State* vm) { |
5536 |
const char *filename; |
5536 |
const char *filename; |
5537 |
unsigned long pdp_step; |
5537 |
unsigned long pdp_step; |
5538 |
const char **argv; |
5538 |
char **argv; |
5539 |
int argc, status, offset = 3; |
5539 |
int argc, status, offset = 3; |
5540 |
time_t start_time = time(NULL)-86400 /* 1 day */; |
5540 |
time_t start_time = time(NULL)-86400 /* 1 day */; |
5541 |
|
5541 |
|
Lines 5558-5564
static int ntop_rrd_create(lua_State* vm) {
Link Here
|
5558 |
argv = make_argv(vm, &argc, offset, 0); |
5558 |
argv = make_argv(vm, &argc, offset, 0); |
5559 |
|
5559 |
|
5560 |
reset_rrd_state(); |
5560 |
reset_rrd_state(); |
5561 |
status = rrd_create_r(filename, pdp_step, start_time, argc, argv); |
5561 |
status = rrd_create_r(filename, pdp_step, start_time, argc, (const char**)argv); |
5562 |
free(argv); |
5562 |
free(argv); |
5563 |
|
5563 |
|
5564 |
if(status != 0) { |
5564 |
if(status != 0) { |
Lines 5690-5696
static int ntop_rrd_lastupdate(lua_State* vm) {
Link Here
|
5690 |
|
5690 |
|
5691 |
static int ntop_rrd_tune(lua_State* vm) { |
5691 |
static int ntop_rrd_tune(lua_State* vm) { |
5692 |
const char *filename; |
5692 |
const char *filename; |
5693 |
const char **argv; |
5693 |
char **argv; |
5694 |
int argc, status, offset = 1; |
5694 |
int argc, status, offset = 1; |
5695 |
int extra_args = 1; /* Program name arg*/ |
5695 |
int extra_args = 1; /* Program name arg*/ |
5696 |
|
5696 |
|
Lines 5706-5712
static int ntop_rrd_tune(lua_State* vm) {
Link Here
|
5706 |
filename = argv[1]; |
5706 |
filename = argv[1]; |
5707 |
|
5707 |
|
5708 |
reset_rrd_state(); |
5708 |
reset_rrd_state(); |
5709 |
status = rrd_tune(argc, (char**)argv); |
5709 |
status = rrd_tune(argc, (const char**)argv); |
5710 |
|
5710 |
|
5711 |
if(status != 0) { |
5711 |
if(status != 0) { |
5712 |
char *err = rrd_get_error(); |
5712 |
char *err = rrd_get_error(); |