Skip to content

Commit

Permalink
vlock: improve eintr patch
Browse files Browse the repository at this point in the history
  • Loading branch information
viric committed Mar 11, 2017
1 parent a5f4e22 commit a2737b1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkgs/misc/screensavers/vlock/eintr.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ vlock-start[14567]: vlock-new: could not activate new terminal: Interrupted syst

I think this should fix that.

Also on github: https://github.com/viric/vlock/commit/781a26087f83c7247601b6f82f784cca9266694e

diff --git a/modules/new.c b/modules/new.c
index e9b15fb..1f692fd 100644
index e9b15fb..7aed640 100644
--- a/modules/new.c
+++ b/modules/new.c
@@ -103,7 +103,10 @@ static char *get_console_name(int n)
@@ -103,9 +103,19 @@ static char *get_console_name(int n)
* file descriptor. */
static int activate_console(int consfd, int vtno)
{
Expand All @@ -18,5 +20,15 @@ index e9b15fb..1f692fd 100644
+ c = ioctl(consfd, VT_ACTIVATE, vtno);
+ } while(c != 0 && errno == EINTR);

return c < 0 ? c : ioctl(consfd, VT_WAITACTIVE, vtno);
- return c < 0 ? c : ioctl(consfd, VT_WAITACTIVE, vtno);
+ if (c < 0)
+ return c;
+
+ do {
+ c = ioctl(consfd, VT_WAITACTIVE, vtno);
+ } while(c != 0 && errno == EINTR);
+
+ return c;
}

struct new_console_context {

0 comments on commit a2737b1

Please sign in to comment.