From: Christian Brauner Date: Sun, 29 Jul 2018 21:57:30 +0000 (+0200) Subject: caps: handle EINTR in read() X-Git-Tag: lxc-3.1.0~185^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81f870669671fb85b32873553271f23daaec21bb;p=thirdparty%2Flxc.git 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 --- diff --git a/src/lxc/caps.c b/src/lxc/caps.c index 4c39ce5c9..344a3389b 100644 --- a/src/lxc/caps.c +++ b/src/lxc/caps.c @@ -309,7 +309,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;