[git commit] udhcp: do not clobber errno by signal handler

Denys Vlasenko vda.linux at googlemail.com
Thu Feb 16 19:04:19 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=dc207f669675a271812a21b0ddbe3b894adf8e4c
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/udhcp/signalpipe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index 6355c5e..30bccd6 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -25,9 +25,11 @@ static struct fd_pair signal_pipe;
 
 static void signal_handler(int sig)
 {
+	int sv = errno;
 	unsigned char ch = sig; /* use char, avoid dealing with partial writes */
 	if (write(signal_pipe.wr, &ch, 1) != 1)
 		bb_perror_msg("can't send signal");
+	errno = sv;
 }
 
 /* Call this before doing anything else. Sets up the socket pair


More information about the busybox-cvs mailing list