Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 198252
Collapse All | Expand All

(-)a/arp.c (-1 / +1 lines)
Lines 143-149 int arp_claim (interface_t *iface, struct in_addr address) Link Here
143
			maxfd = signal_fd_set (&rset, iface->fd);
143
			maxfd = signal_fd_set (&rset, iface->fd);
144
			if ((s = select (maxfd + 1, &rset, NULL, NULL, &tv)) == -1) {
144
			if ((s = select (maxfd + 1, &rset, NULL, NULL, &tv)) == -1) {
145
				if (errno == EINTR) {
145
				if (errno == EINTR) {
146
					if (signal_read (NULL) == -1) {
146
					if (signal_exists (NULL) == -1) {
147
						errno = 0;
147
						errno = 0;
148
						continue;
148
						continue;
149
					} else
149
					} else
(-)a/client.c (-2 / +1 lines)
Lines 432-438 int dhcp_run (const options_t *options, int *pidfd) Link Here
432
			retval = 0;
432
			retval = 0;
433
433
434
		/* We should always handle our signals first */
434
		/* We should always handle our signals first */
435
		if ((sig = (signal_read (NULL))) != -1)
435
		if ((sig = (signal_read (&rset))) != -1)
436
		{
436
		{
437
			switch (sig) {
437
			switch (sig) {
438
				case SIGINT:
438
				case SIGINT:
Lines 446-452 int dhcp_run (const options_t *options, int *pidfd) Link Here
446
					goto eexit;
446
					goto eexit;
447
447
448
				case SIGALRM:
448
				case SIGALRM:
449
450
					logger (LOG_INFO, "received SIGALRM, renewing lease");
449
					logger (LOG_INFO, "received SIGALRM, renewing lease");
451
					switch (state) {
450
					switch (state) {
452
						case STATE_BOUND:
451
						case STATE_BOUND:
(-)a/signals.c (-9 / +18 lines)
Lines 84-104 int signal_fd_set (fd_set *rfds, int extra_fd) Link Here
84
	return signal_pipe[0] > extra_fd ? signal_pipe[0] : extra_fd;
84
	return signal_pipe[0] > extra_fd ? signal_pipe[0] : extra_fd;
85
}
85
}
86
86
87
/* Check if we have a signal or not */
88
int signal_exists (const fd_set *rfds)
89
{
90
	if (signal_signal || (rfds && FD_ISSET (signal_pipe[0], rfds)))
91
		return 0;
92
	return -1;
93
}
94
87
/* Read a signal from the signal pipe. Returns 0 if there is
95
/* Read a signal from the signal pipe. Returns 0 if there is
88
 * no signal, -1 on error (and sets errno appropriately), and
96
 * no signal, -1 on error (and sets errno appropriately), and
89
 * your signal on success */
97
 * your signal on success */
90
int signal_read (const fd_set *rfds)
98
int signal_read (fd_set *rfds)
91
{
99
{
92
	int sig;
100
	int sig = -1;
93
101
94
	if (signal_signal)
102
	if (signal_signal) {
95
		return signal_signal;
103
		sig = signal_signal;
104
		signal_signal = 0;
105
	}
96
106
97
	if (! rfds || ! FD_ISSET (signal_pipe[0], rfds))
107
	if (rfds && FD_ISSET (signal_pipe[0], rfds)) {
98
		return -1;
108
		read (signal_pipe[0], &sig, sizeof (sig));
99
	
109
		FD_CLR (signal_pipe[0], rfds);
100
	if (read (signal_pipe[0], &sig, sizeof (sig)) == -1)
110
	}
101
		return -1;
102
111
103
	return sig;
112
	return sig;
104
}
113
}
(-)a/signals.h (-1 / +2 lines)
Lines 22-27 Link Here
22
22
23
void signal_setup (void);
23
void signal_setup (void);
24
int signal_fd_set (fd_set *rfds, int extra_fd);
24
int signal_fd_set (fd_set *rfds, int extra_fd);
25
int signal_read (const fd_set *rfds);
25
int signal_exists (const fd_set *rfds);
26
int signal_read (fd_set *rfds);
26
27
27
#endif
28
#endif

Return to bug 198252