Skip to content

Commit

Permalink
caps: handle EINTR in read()
Browse files Browse the repository at this point in the history
We don't want to link caps.{c,h} against utils.{c,h} for the sake of our static
builds init.lxc.static. This means lxc_write_nointr() will not be available. So
handle it EINTR.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 10, 2018
1 parent c66853b commit b608a3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lxc/caps.c
Expand Up @@ -315,7 +315,11 @@ static int _real_caps_last_cap(void)
char *ptr;
int n;

if ((n = read(fd, buf, 31)) >= 0) {
again:
n = read(fd, buf, 31);
if (n < 0 && errno == EINTR) {
goto again;
} else if (n >= 0) {
buf[n] = '\0';
errno = 0;

Expand Down

0 comments on commit b608a3d

Please sign in to comment.