datatop: Fix compilation errors due to -Werror
Compiler warnings marked as errors made it impossible to build this project successfully. This patch fixes said warnings, allowing the project to be compiled. This patch also fixes the observed segfault behavior and fixes the behavior of command line options. Change-Id: Iede2b0d9ffac33737694ea3313c6e1a68de3ed44
This commit is contained in:
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (usr_cl_opts.iptables_rules_routes == OPT_CHOSE) {
|
if (usr_cl_opts.iptables_rules_routes == OPT_CHOSE) {
|
||||||
if (!usr_cl_opts.out_dir) {
|
if (usr_cl_opts.out_dir[0] == '\0') {
|
||||||
printf("Please provide an out directory.\n");
|
printf("Please provide an out directory.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ static void dt_dev_parse(char *line1, int len1,
|
|||||||
if (line1[j] != ' ' && line1[j] != ' ') {
|
if (line1[j] != ' ' && line1[j] != ' ') {
|
||||||
dict->val[k] = &line1[j];
|
dict->val[k] = &line1[j];
|
||||||
n = j;
|
n = j;
|
||||||
while (line1[n] != ' ' && line1[n] != ' ')
|
while (line1[n] != 0 && line1[n] != ' ' && line1[n] != ' ')
|
||||||
n++;
|
n++;
|
||||||
if (n < len1)
|
if (n < len1)
|
||||||
line1[n] = 0;
|
line1[n] = 0;
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ int dtop_ip_table_poll(struct dtop_data_point_gatherer *dpg)
|
|||||||
static void dtop_ip_table_dpg_deconstructor
|
static void dtop_ip_table_dpg_deconstructor
|
||||||
(struct dtop_data_point_gatherer *dpset)
|
(struct dtop_data_point_gatherer *dpset)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
free(dpset->prefix);
|
free(dpset->prefix);
|
||||||
if(dpset->file)
|
if(dpset->file)
|
||||||
{
|
{
|
||||||
@@ -179,9 +178,6 @@ int dtop_ip_table_init_files()
|
|||||||
*/
|
*/
|
||||||
void dtop_ip_table_poll_cleanup()
|
void dtop_ip_table_poll_cleanup()
|
||||||
{
|
{
|
||||||
struct dtop_data_point_gatherer *dpset;
|
|
||||||
struct dtop_linked_list *curr_ptr = ip_dpg_list;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&dtop_ip_table_lock);
|
pthread_mutex_lock(&dtop_ip_table_lock);
|
||||||
deconstruct_dpgs(ip_dpg_list);
|
deconstruct_dpgs(ip_dpg_list);
|
||||||
dtop_rem_linked_list(ip_dpg_list);
|
dtop_rem_linked_list(ip_dpg_list);
|
||||||
@@ -200,6 +196,8 @@ void *dtop_ip_table_start_poll(void *arg)
|
|||||||
double diff_t = 9999999.00; /* some high # > DTOP_IPTRR_POLL_PERIOD */
|
double diff_t = 9999999.00; /* some high # > DTOP_IPTRR_POLL_PERIOD */
|
||||||
int ret = DTOP_POLL_OK;
|
int ret = DTOP_POLL_OK;
|
||||||
|
|
||||||
|
(void) arg;
|
||||||
|
|
||||||
if (pthread_mutex_init(&dtop_ip_table_lock, NULL) != 0)
|
if (pthread_mutex_init(&dtop_ip_table_lock, NULL) != 0)
|
||||||
{
|
{
|
||||||
printf("\n mutex init failed\n");
|
printf("\n mutex init failed\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user