Skip to content
Snippets Groups Projects
Commit 48ccbdb0 authored by Sean Tranchetti's avatar Sean Tranchetti
Browse files

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
parent 5b903dda
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,7 @@ int main(int argc, char **argv)
}
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");
exit(EXIT_FAILURE);
}
......
......@@ -89,7 +89,7 @@ static void dt_dev_parse(char *line1, int len1,
if (line1[j] != ' ' && line1[j] != ' ') {
dict->val[k] = &line1[j];
n = j;
while (line1[n] != ' ' && line1[n] != ' ')
while (line1[n] != 0 && line1[n] != ' ' && line1[n] != ' ')
n++;
if (n < len1)
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
(struct dtop_data_point_gatherer *dpset)
{
int i;
free(dpset->prefix);
if(dpset->file)
{
......@@ -179,9 +178,6 @@ int dtop_ip_table_init_files()
*/
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);
deconstruct_dpgs(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 */
int ret = DTOP_POLL_OK;
(void) arg;
if (pthread_mutex_init(&dtop_ip_table_lock, NULL) != 0)
{
printf("\n mutex init failed\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment