From b608a3d963003925e3e9406185a0497bf1be6fd5 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 29 Jul 2018 23:57:30 +0200 Subject: [PATCH] caps: handle EINTR in read() 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 --- src/lxc/caps.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/caps.c b/src/lxc/caps.c index a697856ac5..5638c712e1 100644 --- a/src/lxc/caps.c +++ b/src/lxc/caps.c @@ -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;