Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 135354 Details for
Bug 198252
net-misc/dhcpcd-3.1.7 logging DoS
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
clear signals when read
alrm.patch (text/plain), 2.35 KB, created by
Roy Marples (RETIRED)
on 2007-11-06 18:20:59 UTC
(
hide
)
Description:
clear signals when read
Filename:
MIME Type:
Creator:
Roy Marples (RETIRED)
Created:
2007-11-06 18:20:59 UTC
Size:
2.35 KB
patch
obsolete
>diff --git a/arp.c b/arp.c >index 72574d0..e42781c 100644 >--- a/arp.c >+++ b/arp.c >@@ -143,7 +143,7 @@ int arp_claim (interface_t *iface, struct in_addr address) > maxfd = signal_fd_set (&rset, iface->fd); > if ((s = select (maxfd + 1, &rset, NULL, NULL, &tv)) == -1) { > if (errno == EINTR) { >- if (signal_read (NULL) == -1) { >+ if (signal_exists (NULL) == -1) { > errno = 0; > continue; > } else >diff --git a/client.c b/client.c >index fededbc..4c3c740 100644 >--- a/client.c >+++ b/client.c >@@ -432,7 +432,7 @@ int dhcp_run (const options_t *options, int *pidfd) > retval = 0; > > /* We should always handle our signals first */ >- if ((sig = (signal_read (NULL))) != -1) >+ if ((sig = (signal_read (&rset))) != -1) > { > switch (sig) { > case SIGINT: >@@ -446,7 +446,6 @@ int dhcp_run (const options_t *options, int *pidfd) > goto eexit; > > case SIGALRM: >- > logger (LOG_INFO, "received SIGALRM, renewing lease"); > switch (state) { > case STATE_BOUND: >diff --git a/signals.c b/signals.c >index 214a624..b80d784 100644 >--- a/signals.c >+++ b/signals.c >@@ -84,21 +84,30 @@ int signal_fd_set (fd_set *rfds, int extra_fd) > return signal_pipe[0] > extra_fd ? signal_pipe[0] : extra_fd; > } > >+/* Check if we have a signal or not */ >+int signal_exists (const fd_set *rfds) >+{ >+ if (signal_signal || (rfds && FD_ISSET (signal_pipe[0], rfds))) >+ return 0; >+ return -1; >+} >+ > /* Read a signal from the signal pipe. Returns 0 if there is > * no signal, -1 on error (and sets errno appropriately), and > * your signal on success */ >-int signal_read (const fd_set *rfds) >+int signal_read (fd_set *rfds) > { >- int sig; >+ int sig = -1; > >- if (signal_signal) >- return signal_signal; >+ if (signal_signal) { >+ sig = signal_signal; >+ signal_signal = 0; >+ } > >- if (! rfds || ! FD_ISSET (signal_pipe[0], rfds)) >- return -1; >- >- if (read (signal_pipe[0], &sig, sizeof (sig)) == -1) >- return -1; >+ if (rfds && FD_ISSET (signal_pipe[0], rfds)) { >+ read (signal_pipe[0], &sig, sizeof (sig)); >+ FD_CLR (signal_pipe[0], rfds); >+ } > > return sig; > } >diff --git a/signals.h b/signals.h >index 1accb6c..b043dbf 100644 >--- a/signals.h >+++ b/signals.h >@@ -22,6 +22,7 @@ > > void signal_setup (void); > int signal_fd_set (fd_set *rfds, int extra_fd); >-int signal_read (const fd_set *rfds); >+int signal_exists (const fd_set *rfds); >+int signal_read (fd_set *rfds); > > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198252
: 135354