]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tree-wide: handle EINTR in some read()/write() 2371/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 1 Jun 2018 17:53:06 +0000 (19:53 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 1 Jun 2018 17:55:17 +0000 (19:55 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c
src/lxc/start.c

index b67a90b6b1bd60e2da5c220a4214691fa1134033..05d58081e6d2ea03c4096f6fb4d058f5ea9acea1 100644 (file)
@@ -2332,11 +2332,11 @@ FILE *make_anonymous_mount_file(struct lxc_list *mount)
                mount_entry = iterator->elem;
                len = strlen(mount_entry);
 
-               ret = write(fd, mount_entry, len);
+               ret = lxc_write_nointr(fd, mount_entry, len);
                if (ret != len)
                        goto on_error;
 
-               ret = write(fd, "\n", 1);
+               ret = lxc_write_nointr(fd, "\n", 1);
                if (ret != 1)
                        goto on_error;
        }
@@ -3951,7 +3951,7 @@ static int run_userns_fn(void *data)
        /* Wait for parent to finish establishing a new mapping in the user
         * namespace we are executing in.
         */
-       if (read(d->p[0], &c, 1) != 1)
+       if (lxc_read_nointr(d->p[0], &c, 1) != 1)
                return -1;
 
        /* Close read end of the pipe. */
@@ -4224,7 +4224,7 @@ int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data,
        }
 
        /* Tell child to proceed. */
-       if (write(p[1], &c, 1) != 1) {
+       if (lxc_write_nointr(p[1], &c, 1) != 1) {
                SYSERROR("Failed telling child process \"%d\" to proceed", pid);
                goto on_error;
        }
@@ -4401,7 +4401,7 @@ int userns_exec_full(struct lxc_conf *conf, int (*fn)(void *), void *data,
        }
 
        /* Tell child to proceed. */
-       if (write(p[1], &c, 1) != 1) {
+       if (lxc_write_nointr(p[1], &c, 1) != 1) {
                SYSERROR("Failed telling child process \"%d\" to proceed", pid);
                goto on_error;
        }
index 882e375660be94ff76b8c4a6d86c6b1029917e75..b222c847aa583c1f8f1a0ffd80400c4ce4ee6ff1 100644 (file)
@@ -340,7 +340,7 @@ static int signal_handler(int fd, uint32_t events, void *data,
        struct signalfd_siginfo siginfo;
        struct lxc_handler *hdlr = data;
 
-       ret = read(fd, &siginfo, sizeof(siginfo));
+       ret = lxc_read_nointr(fd, &siginfo, sizeof(siginfo));
        if (ret < 0) {
                ERROR("Failed to read signal info from signal file descriptor %d", fd);
                return LXC_MAINLOOP_ERROR;