Skip to contentSkip to conversation

open_init_pty: Do not error on EINTR

PATCH Applied Jason Zaman 2 participants 2 messages Jul 3, 2016 – Jul 12, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 open_init_pty: Do not error on EINTR

There is a signal handler so that the select returns EINTR when the child exits. EINTR is used to then clean up and flush the remaining buffers. It should not error.

---
 policycoreutils/run_init/open_init_pty.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
policycoreutils/run_init/open_init_pty.c +2 -1
index 37805bf..6e25ea3 100644
@@ -327,8 +327,9 @@ int main(int argc, char *argv[])
 			break;
 		}
 
+		errno = 0;
 		int select_rc = select(pty_master + 1, &readfds, &writefds, NULL, NULL);
-		if (select_rc < 0) {
+		if (select_rc < 0 && errno != EINTR) {
 			perror("select()");
 			exit(EX_IOERR);
 		}
Signature · 1 line
2.7.3
#1 lore raw
Quoted 5 lines · Jason Zaman

There is a signal handler so that the select returns EINTR when the child exits. EINTR is used to then clean up and flush the remaining buffers. It should not error.

Thanks, applied.

Quoted 20 lines
---
 policycoreutils/run_init/open_init_pty.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
policycoreutils/run_init/open_init_pty.c +2 -1
index 37805bf..6e25ea3 100644
@@ -327,8 +327,9 @@ int main(int argc, char *argv[])
 			break;
 		}
 
+		errno = 0;
 		int select_rc = select(pty_master + 1, &readfds, &writefds, NULL, NULL);
-		if (select_rc < 0) {
+		if (select_rc < 0 && errno != EINTR) {
 			perror("select()");
 			exit(EX_IOERR);
 		}