Bug #863


1.4.3: src/util-logopenfile.c : sun is a reserved word

Added by Mark Solaris over 9 years ago. Updated over 5 years ago.

Target version:
Affected Versions:


On Solaris it's probably not a good idea to use 'sun' as a variable:

"util-logopenfile.c", line 43: syntax error before or at: 1
"util-logopenfile.c", line 44: invalid type combination
"util-logopenfile.c", line 44: cannot recover from previous errors

Here's a diff to change the variable name:

--- suricata-1.4.3/src/util-logopenfile.c.orig  Mon Jul  8 15:56:14 2013
+++ suricata-1.4.3/src/util-logopenfile.c       Mon Jul  8 16:00:16 2013
@@ -40,19 +40,19 @@
 static FILE *
 SCLogOpenUnixSocketFp(const char *path, int sock_type)
-    struct sockaddr_un sun;
     int s = -1;
+    struct sockaddr_un my_sock_unix;
     FILE * ret = NULL;

-    memset(&sun, 0x00, sizeof(sun));
+    memset(&my_sock_unix, 0x00, sizeof(my_sock_unix));

     s = socket(PF_UNIX, sock_type, 0);
     if (s < 0) goto err;

-    sun.sun_family = AF_UNIX;
-    strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
+    my_sock_unix.sun_family = AF_UNIX;
+    strlcpy(my_sock_unix.sun_path, path, sizeof(my_sock_unix.sun_path));

-    if (connect(s, (const struct sockaddr *)&sun, sizeof(sun)) < 0)
+    if (connect(s, (const struct sockaddr *)&my_sock_unix, sizeof(my_sock_unix)) < 0)
         goto err;

     ret = fdopen(s, "w");
Actions #1

Updated by Victor Julien over 9 years ago

  • Target version set to TBD
Actions #2

Updated by Mark Solaris about 9 years ago

This fault still exists in master 2013-12-02

Actions #3

Updated by Andreas Herz about 7 years ago

  • Status changed from New to Closed
Actions #4

Updated by Mark Solaris about 7 years ago

Why are all these bugs being set to closed without comments or corrections?

Actions #5

Updated by Victor Julien about 7 years ago

The problem with the patches is that they need to be supplied through git(hub):

For a rarely used system like this I can't justify our devs going over each of the tickets/patches, forward port them, etc. I have no objections to trying to support SunOS, but it will have to be made easy for the team. This is also why at the time I tried to convince you to do thing in git right away.

Actions #6

Updated by Victor Julien over 5 years ago

  • Target version deleted (TBD)

Also available in: Atom PDF