File iptraf-3.0.0-strict-aliasing.patch of Package iptraf

--- src/bar.c
+++ src/bar.c
@@ -20,7 +20,7 @@
 #include <winops.h>
 #include "attrs.h"
 
-void set_barptr(char **barptr, char *entry,
+void set_barptr(struct portlistent **barptr, struct portlistent *entry,
                 time_t * starttime, char *spanbr, size_t size,
                 WINDOW * win, int *cleared, int x)
 {
--- src/bar.h
+++ src/bar.h
@@ -1,3 +1,3 @@
-void set_barptr(char **barptr, char *entry,
+void set_barptr(struct portlistent **barptr, struct portlistent *entry,
                 time_t * starttime, char *spanbr, size_t size,
                 WINDOW * win, int *cleared, int x);
--- src/itrafmon.c
+++ src/itrafmon.c
@@ -846,8 +846,8 @@
                         if (table.barptr != NULL) {
                             if (table.barptr->prev_entry != NULL) {
                                 tmptcp = table.barptr;
-                                set_barptr((char **) &(table.barptr),
-                                           (char *) table.barptr->
+                                set_barptr(&(table.barptr),
+                                           table.barptr->
                                            prev_entry,
                                            &(table.barptr->prev_entry->
                                              starttime),
@@ -877,8 +877,8 @@
                         if (table.barptr != NULL) {
                             if (table.barptr->next_entry != NULL) {
                                 tmptcp = table.barptr;
-                                set_barptr((char **) &(table.barptr),
-                                           (char *) table.barptr->
+                                set_barptr(&(table.barptr),
+                                           table.barptr->
                                            next_entry,
                                            &(table.barptr->next_entry->
                                              starttime),
@@ -924,8 +924,8 @@
                         if (table.barptr != NULL) {
                             pageupperwin(&table, SCROLLDOWN, &screen_idx,
                                          mode);
-                            set_barptr((char **) &(table.barptr),
-                                       (char *) table.lastvisible,
+                            set_barptr(&(table.barptr),
+                                       table.lastvisible,
                                        &(table.lastvisible->starttime),
                                        (char *) &(table.lastvisible->
                                                   spanbr),
@@ -946,8 +946,8 @@
                         if (table.barptr != NULL) {
                             pageupperwin(&table, SCROLLUP, &screen_idx,
                                          mode);
-                            set_barptr((char **) &(table.barptr),
-                                       (char *) table.firstvisible,
+                            set_barptr(&(table.barptr),
+                                       table.firstvisible,
                                        &(table.firstvisible->starttime),
                                        (char *) &(table.firstvisible->
                                                   spanbr),
@@ -1017,8 +1017,8 @@
                            options->timeout, &nomem, options);
 
                 if (table.barptr != NULL) {
-                    set_barptr((char **) &(table.barptr),
-                               (char *) table.firstvisible,
+                    set_barptr(&(table.barptr),
+                               table.firstvisible,
                                &(table.firstvisible->starttime),
                                (char *) &(table.firstvisible->spanbr),
                                sizeof(unsigned long), statwin,
@@ -1101,9 +1101,9 @@
                                                screen_idx, mode);
 
                                     if (wasempty) {
-                                        set_barptr((char **)
+                                        set_barptr(
                                                    &(table.barptr),
-                                                   (char *) table.
+                                                   table.
                                                    firstvisible,
                                                    &(table.firstvisible->
                                                      starttime),
@@ -1119,9 +1119,9 @@
                                     if ((table.barptr == tcpentry) ||
                                         (table.barptr ==
                                          tcpentry->oth_connection))
-                                        set_barptr((char **)
+                                        set_barptr(
                                                    &(table.barptr),
-                                                   (char *) table.barptr,
+                                                   table.barptr,
                                                    &(table.barptr->
                                                      starttime),
                                                    (char *) &(table.
--- src/serv.c
+++ src/serv.c
@@ -763,6 +763,7 @@
     FILE *logfile = NULL;
 
     struct promisc_states *promisc_list;
+	union {char *c; void *v;} u; //strict alliasing fix
 
     WINDOW *sortwin;
     PANEL *sortpanel;
@@ -910,8 +911,8 @@
                     if (list.barptr != NULL) {
                         if (list.barptr->prev_entry != NULL) {
                             serv_tmp = list.barptr;
-                            set_barptr((char **) &(list.barptr),
-                                       (char *) list.barptr->prev_entry,
+                            set_barptr(&(list.barptr),
+                                         list.barptr->prev_entry,
                                        &(list.barptr->prev_entry->
                                          starttime),
                                        (char *) &(list.barptr->prev_entry->
@@ -933,8 +934,8 @@
                     if (list.barptr != NULL) {
                         if (list.barptr->next_entry != NULL) {
                             serv_tmp = list.barptr;
-                            set_barptr((char **) &(list.barptr),
-                                       (char *) list.barptr->next_entry,
+                            set_barptr(&(list.barptr),
+                                        list.barptr->next_entry,
                                        &(list.barptr->next_entry->
                                          starttime),
                                        (char *) &(list.barptr->next_entry->
@@ -957,8 +958,8 @@
                     if (list.barptr != NULL) {
                         pageservwin(&list, SCROLLDOWN, &idx);
 
-                        set_barptr((char **) &(list.barptr),
-                                   (char *) (list.lastvisible),
+                        set_barptr(&(list.barptr),
+                                   (list.lastvisible),
                                    &(list.lastvisible->starttime),
                                    (char *) &(list.lastvisible->spans),
                                    sizeof(struct serv_spans), statwin,
@@ -973,8 +974,8 @@
                     if (list.barptr != NULL) {
                         pageservwin(&list, SCROLLUP, &idx);
 
-                        set_barptr((char **) &(list.barptr),
-                                   (char *) (list.firstvisible),
+                        set_barptr(&(list.barptr),
+                                   (list.firstvisible),
                                    &(list.firstvisible->starttime),
                                    (char *) &(list.firstvisible->spans),
                                    sizeof(struct serv_spans), statwin,
@@ -1008,8 +1009,8 @@
                 sortportents(&list, &idx, ch);
                 keymode = 0;
                 if (list.barptr != NULL) {
-                    set_barptr((char **) &(list.barptr),
-                               (char *) list.firstvisible,
+                    set_barptr(&(list.barptr),
+                               list.firstvisible,
                                &(list.firstvisible->starttime),
                                (char *) &(list.firstvisible->spans),
                                sizeof(struct serv_spans), statwin,
@@ -1040,8 +1041,8 @@
                               idx, ports, options->servnames);
 
                 if ((list.barptr == NULL) && (list.head != NULL)) {
-                    set_barptr((char **) &(list.barptr),
-                               (char *) list.head, &(list.head->starttime),
+                    set_barptr(&(list.barptr),
+                               list.head, &(list.head->starttime),
                                (char *) &(list.head->spans),
                                sizeof(struct serv_spans), statwin,
                                &statcleared, statx);
openSUSE Build Service is sponsored by