Project

General

Profile

Actions

Bug #863

closed

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

Added by Mark Solaris almost 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Affected Versions:
Effort:
Difficulty:
Label:

Description

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

Also available in: Atom PDF