Skip to content

Commit

Permalink
caps: replace read with lxc_read_nointr
Browse files Browse the repository at this point in the history
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
  • Loading branch information
2xsec authored and Christian Brauner committed Nov 22, 2018
1 parent 1b02aa5 commit ede7283
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lxc/caps.c
Expand Up @@ -33,6 +33,7 @@

#include "caps.h"
#include "config.h"
#include "file_utils.h"
#include "log.h"
#include "macro.h"

Expand Down Expand Up @@ -299,11 +300,8 @@ static long int _real_caps_last_cap(void)
char *ptr;
char buf[INTTYPE_TO_STRLEN(int)] = {0};

again:
n = read(fd, buf, STRARRAYLEN(buf));
if (n < 0 && errno == EINTR) {
goto again;
} else if (n >= 0) {
n = lxc_read_nointr(fd, buf, STRARRAYLEN(buf));
if (n >= 0) {
errno = 0;
result = strtol(buf, &ptr, 10);
if (!ptr || (*ptr != '\0' && *ptr != '\n') || errno != 0)
Expand Down

0 comments on commit ede7283

Please sign in to comment.