]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't use sun_len on systems that don't support it
authorTed Lemon <source@isc.org>
Sat, 29 Nov 1997 07:52:33 +0000 (07:52 +0000)
committerTed Lemon <source@isc.org>
Sat, 29 Nov 1997 07:52:33 +0000 (07:52 +0000)
common/sysconf.c
statmsg/main.c
sysconfd/sysconfd.c

index 2795d006d3ead5ce73b28a983e24fce445095fac..f2a8004753964d4e97ab3edec20edfa5d9a742c5 100644 (file)
@@ -44,7 +44,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: sysconf.c,v 1.2 1997/10/20 22:10:59 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: sysconf.c,v 1.3 1997/11/29 07:52:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -57,6 +57,7 @@ void sysconf_startup (handler)
 {
        struct sockaddr_un name;
        static int once;
+       int len;
 
        /* Only initialize sysconf once. */
        if (sysconf_initialized)
@@ -70,10 +71,13 @@ void sysconf_startup (handler)
        /* XXX for now... */
        name.sun_family = PF_UNIX;
        strcpy (name.sun_path, "/var/run/sysconf");
-       name.sun_len = ((sizeof name) - (sizeof name.sun_path) +
-                       strlen (name.sun_path));
+#if defined (HAVE_SA_LEN)
+       name.sun_len =
+#endif
+               len = ((sizeof name) - (sizeof name.sun_path) +
+                      strlen (name.sun_path));
 
-       if (connect (sysconf_fd, (struct sockaddr *)&name, name.sun_len) < 0) {
+       if (connect (sysconf_fd, (struct sockaddr *)&name, len) < 0) {
                if (!once)
                        warn ("can't connect to sysconf socket: %m");
                once = 1;
index 1cd0e5d89f0a9f72ede7b7999ed66ba15d5e4fc9..924b9cea522059da9d31c39fc5925edf2755b8bf 100644 (file)
@@ -44,7 +44,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: main.c,v 1.2 1997/10/20 22:04:23 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: main.c,v 1.3 1997/11/29 07:48:37 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -62,6 +62,7 @@ int main (argc, argv, envp)
        struct sysconf_header hdr;
        int status;
        char *buf;
+       int len;
 
 #ifdef SYSLOG_4_2
        openlog ("statmsg", LOG_NDELAY);
@@ -90,10 +91,13 @@ int main (argc, argv, envp)
        /* XXX for now... */
        name.sun_family = PF_UNIX;
        strcpy (name.sun_path, "/var/run/sysconf");
-       name.sun_len = ((sizeof name) - (sizeof name.sun_path) +
-                       strlen (name.sun_path));
+#if defined (HAVE_SA_LEN)
+       name.sun_len = 
+#endif
+               len = ((sizeof name) - (sizeof name.sun_path) +
+                      strlen (name.sun_path));
 
-       if (connect (sysconf_fd, (struct sockaddr *)&name, name.sun_len) < 0)
+       if (connect (sysconf_fd, (struct sockaddr *)&name, len) < 0)
                error ("can't connect to sysconf socket: %m");
 
        status = write (sysconf_fd, &hdr, sizeof hdr);
index 5d59816efdf12cddc9e2a8e152665777d1b426ba..399b2fe83677c4e0b0c60c6e83c86e2b9b5cab1a 100644 (file)
@@ -44,7 +44,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: sysconfd.c,v 1.2 1997/10/20 22:11:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: sysconfd.c,v 1.3 1997/11/29 07:49:06 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -75,6 +75,7 @@ int main (argc, argv, envp)
        struct sockaddr_un name;
        int sysconf_fd;
        int pid;
+       int len;
 
 #ifdef SYSLOG_4_2
        openlog ("sysconfd", LOG_NDELAY);
@@ -95,12 +96,15 @@ int main (argc, argv, envp)
        /* XXX for now... */
        name.sun_family = PF_UNIX;
        strcpy (name.sun_path, "/var/run/sysconf");
-       name.sun_len = ((sizeof name) - (sizeof name.sun_path) +
-                       strlen (name.sun_path));
+#if defined (HAVE_SA_LEN)
+       name.sun_len =
+#endif
+               len = ((sizeof name) - (sizeof name.sun_path) +
+                      strlen (name.sun_path));
        unlink (name.sun_path);
 
        /* Bind to it... */
-       if (bind (sysconf_fd, (struct sockaddr *)&name, name.sun_len) < 0)
+       if (bind (sysconf_fd, (struct sockaddr *)&name, len) < 0)
                error ("can't bind to sysconf socket: %m");
 
        /* Listen for connections... */