From: Christian Brauner Date: Sun, 29 Jul 2018 21:56:33 +0000 (+0200) Subject: tools: s/read()/lxc_read_nointr()/g X-Git-Tag: lxc-3.1.0~185^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b6f89cd4c2e632238495a5627552cdb0f12eccf;p=thirdparty%2Flxc.git tools: s/read()/lxc_read_nointr()/g Signed-off-by: Christian Brauner --- diff --git a/src/lxc/tools/lxc_destroy.c b/src/lxc/tools/lxc_destroy.c index 35514689f..e208cf6fd 100644 --- a/src/lxc/tools/lxc_destroy.c +++ b/src/lxc/tools/lxc_destroy.c @@ -233,14 +233,13 @@ static bool do_destroy_with_snapshots(struct lxc_container *c) return false; } - ret = read(fd, buf, fbuf.st_size); + ret = lxc_read_nointr(fd, buf, fbuf.st_size); + close(fd); if (ret < 0) { ERROR("Could not read %s", path); - close(fd); free(buf); return false; } - close(fd); lxc_iterate_parts(lxcpath, buf, "\n") { c1 = lxc_container_new(lxcname, lxcpath); diff --git a/src/lxc/tools/lxc_monitor.c b/src/lxc/tools/lxc_monitor.c index abeccdeed..525b296cc 100644 --- a/src/lxc/tools/lxc_monitor.c +++ b/src/lxc/tools/lxc_monitor.c @@ -202,7 +202,7 @@ static int lxc_tool_monitord_spawn(const char *lxcpath) * synced with the child process. the if-empty-statement * construct is to quiet the warn-unused-result warning. */ - if (read(pipefd[0], &c, 1)) + if (lxc_read_nointr(pipefd[0], &c, 1)) ; close(pipefd[0]); diff --git a/src/lxc/tools/lxc_top.c b/src/lxc/tools/lxc_top.c index b873be640..0ffc65e6f 100644 --- a/src/lxc/tools/lxc_top.c +++ b/src/lxc/tools/lxc_top.c @@ -574,7 +574,7 @@ static int stdin_handler(int fd, uint32_t events, void *data, if (events & EPOLLIN) { int rc; - rc = read(fd, in_char, sizeof(*in_char)); + rc = lxc_read_nointr(fd, in_char, sizeof(*in_char)); if (rc <= 0) *in_char = '\0'; } diff --git a/src/lxc/tools/lxc_unshare.c b/src/lxc/tools/lxc_unshare.c index 720ecb378..fa529b9cf 100644 --- a/src/lxc/tools/lxc_unshare.c +++ b/src/lxc/tools/lxc_unshare.c @@ -271,7 +271,7 @@ static int do_start(void *arg) if (start_arg->setuid) { /* waiting until uid maps is set */ - ret = read(start_arg->wait_fd, &wait_val, sizeof(wait_val)); + ret = lxc_read_nointr(start_arg->wait_fd, &wait_val, sizeof(wait_val)); if (ret == -1) { SYSERROR("Failed to read eventfd"); close(start_arg->wait_fd);