Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: ignore EINTR in ztcp/zsocket accept()
- X-seq: zsh-workers 36039
- From: Joshua Krusell <js.shirin@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: ignore EINTR in ztcp/zsocket accept()
- Date: Mon, 10 Aug 2015 12:22:12 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=M7DqR5EDhx3nO85EbHGV/H67b+rVmt02UmrbjSChLBs=; b=Q9OeO7bHHjoHuLrSNIxtyGOv6uMRx+DSA2vERcKzTraSOAYcLuJ9Yjtwpajxw7jMK6 3r467/d9ufLwl5vWSnpXm3iJ+9g5BhQyPcRdhHbhBaWVAWk789wc+exGMRidLmJETngf /fJOnUceSqAxNSvleIbVrfuq81n4zbqpoKLYFkv/Gs5Ojufxk4Ke8axp9u1HSrCM0axl gyteV7hFhvJc5PZglcBBfZHbet50BbxxtNVo/T5nk3yHNh0vFEqCXae+Bzfz9sIeetCU hEcnU1LpQ1QOaI1fxzjhZzhR3dO0YNdC4pYJnrN+zYGbTsrfJv604STEp7QzKOusH8x7 6ehA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Interrupting `ztcp -a` causes zsh to exit immediately. Would it be
appropriate to just ignore EINTR?
/jsks
diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c
index cd56d46..92d0a50 100644
--- a/Src/Modules/socket.c
+++ b/Src/Modules/socket.c
@@ -191,8 +191,11 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func))
}
len = sizeof(soun);
- if ((rfd = accept(lfd, (struct sockaddr *)&soun, &len)) == -1)
- {
+ do {
+ rfd = accept(lfd, (struct sockaddr *)&soun, &len);
+ } while (errno == EINTR && !errflag);
+
+ if (rfd == -1) {
zwarnnam(nam, "could not accept connection: %e", errno);
return 1;
}
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index d5b62a8..3049273 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -536,8 +536,11 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
sess = zts_alloc(ZTCP_INBOUND);
len = sizeof(sess->peer.in);
- if ((rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len)) == -1)
- {
+ do {
+ rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len);
+ } while (errno == EINTR && !errflag);
+
+ if (rfd == -1) {
zwarnnam(nam, "could not accept connection: %e", errno);
tcp_close(sess);
return 1;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author