]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
eloop: set _eloop in signal setup rather than start
authorRoy Marples <roy@marples.name>
Wed, 15 Nov 2017 15:14:24 +0000 (15:14 +0000)
committerRoy Marples <roy@marples.name>
Wed, 15 Nov 2017 15:14:24 +0000 (15:14 +0000)
This fixes a potential issue where a signal could be received
before eloop_start is called.

src/eloop.c

index 3e007f09b5a319306db9391a002354ad01b09ca4..5265578e45f4293ee904681ab283d8b306feb02a 100644 (file)
@@ -785,6 +785,8 @@ eloop_signal_mask(struct eloop *eloop, sigset_t *oldset)
                return -1;
 
 #ifndef HAVE_KQUEUE
+       _eloop = eloop;
+
        memset(&sa, 0, sizeof(sa));
        sa.sa_sigaction = eloop_signal3;
        sa.sa_flags = SA_SIGINFO;
@@ -876,8 +878,6 @@ eloop_start(struct eloop *eloop, sigset_t *signals)
 #endif
 #ifndef HAVE_KQUEUE
        int timeout;
-
-       _eloop = eloop;
 #endif
 
        assert(eloop != NULL);