Skip to content

Commit

Permalink
tools: s/read()/lxc_read_nointr()/g
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jul 29, 2018
1 parent 03876f9 commit 7b6f89c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/lxc/tools/lxc_destroy.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/tools/lxc_monitor.c
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/tools/lxc_top.c
Expand Up @@ -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';
}
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/tools/lxc_unshare.c
Expand Up @@ -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);
Expand Down

0 comments on commit 7b6f89c

Please sign in to comment.