[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/05: 'select' returns empty sets upon EINTR and EAGAIN
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 01/05: 'select' returns empty sets upon EINTR and EAGAIN. |
Date: |
Fri, 16 Feb 2018 09:29:48 -0500 (EST) |
civodul pushed a commit to branch stable-2.2
in repository guile.
commit f390afa0cc84eb84ed2cb3e03f542b991d4bb080
Author: Ludovic Courtès <address@hidden>
Date: Fri Feb 16 14:05:04 2018 +0100
'select' returns empty sets upon EINTR and EAGAIN.
Fixes <https://bugs.gnu.org/30368>.
* libguile/filesys.c (scm_select): Clear READ_SET, WRITE_SET, and
EXCEPT_SET when RV < 0.
---
libguile/filesys.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/libguile/filesys.c b/libguile/filesys.c
index e39dc4a..05dd2bd 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006,
- * 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Free Software Foundation,
Inc.
+ * 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2018 Free Software
Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -900,10 +900,20 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
int rv = scm_std_select (max_fd + 1,
&read_set, &write_set, &except_set,
time_ptr);
- /* Let EINTR / EAGAIN cause a return to the user and let them loop
- to run any asyncs that might be pending. */
- if (rv < 0 && errno != EINTR && errno != EAGAIN)
- SCM_SYSERROR;
+ if (rv < 0)
+ {
+ /* Let EINTR / EAGAIN cause a return to the user and let them
+ loop to run any asyncs that might be pending. */
+ if (errno != EINTR && errno != EAGAIN)
+ SCM_SYSERROR;
+ else
+ {
+ /* Return empty sets. */
+ FD_ZERO (&read_set);
+ FD_ZERO (&write_set);
+ FD_ZERO (&except_set);
+ }
+ }
}
return scm_list_3 (retrieve_select_type (&read_set, read_ports_ready, reads),
- [Guile-commits] branch stable-2.2 updated (07b7490 -> 3986053), Ludovic Courtès, 2018/02/16
- [Guile-commits] 03/05: doc: Fix typo about SRFI-4 syntax., Ludovic Courtès, 2018/02/16
- [Guile-commits] 01/05: 'select' returns empty sets upon EINTR and EAGAIN.,
Ludovic Courtès <=
- [Guile-commits] 02/05: build: Use 'sed' invocation compatible with BSD sed., Ludovic Courtès, 2018/02/16
- [Guile-commits] 04/05: srfi-18: When timeout is a number, it's a relative number of seconds., Ludovic Courtès, 2018/02/16
- [Guile-commits] 05/05: srfi-18: 'thread-sleep!' timeout-as-a-number is relative., Ludovic Courtès, 2018/02/16