dhcpcd-discuss

Fix for build errors on older machines

Petr Gotthard

Wed Feb 05 15:24:30 2020

Hi Roy,
The dhcpcd fails to compile on old machines that don't have O_CLOEXEC and SOCK_CLOEXEC defined.
The following patch does fix the issue for me: there is a funny typo in compat/pidfile.c and a missing include in if.c.

Kind Regards,
Petr


diff -uNr dhcpcd-8.1.6/compat/pidfile.c dhcpcd-8.1.6.modified/compat/pidfile.c
--- dhcpcd-8.1.6/compat/pidfile.c       2020-01-27 21:22:21.000000000 +0100
+++ dhcpcd-8.1.6.modified/compat/pidfile.c      2020-02-05 16:00:00.909545310 +0100
@@ -208,7 +208,7 @@
                        goto return_pid;
 #ifndef O_CLOEXEC
                if ((opts = fcntl(fd, F_GETFD)) == -1 ||
-                   fctnl(fd, F_SETFL, opts | FD_CLOEXEC) == -1)
+                   fcntl(fd, F_SETFL, opts | FD_CLOEXEC) == -1)
                {
                        int error = errno;

diff -uNr dhcpcd-8.1.6/src/if.c dhcpcd-8.1.6.modified/src/if.c
--- dhcpcd-8.1.6/src/if.c       2020-01-27 21:22:21.000000000 +0100
+++ dhcpcd-8.1.6.modified/src/if.c      2020-02-05 15:59:40.517585875 +0100
@@ -60,6 +60,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <fcntl.h>

 #include "common.h"
 #include "dev.h"

Follow-Ups:
Re: Fix for build errors on older machinesRoy Marples
Archive administrator: postmaster@marples.name