<div dir="ltr">Yes, sorry.<div><br></div><div>I have just sent a second version of the patch.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-13 20:37 GMT+00:00 Andrei Vagin <span dir="ltr"><<a href="mailto:avagin@virtuozzo.com" target="_blank">avagin@virtuozzo.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Mar 10, 2017 at 09:43:39AM +0000, Rodrigo Bruno wrote:<br>
> Signed-off-by: Rodrigo Bruno <<a href="mailto:rbruno@gsd.inesc-id.pt">rbruno@gsd.inesc-id.pt</a>><br>
> ---<br>
> criu/image.c | 15 ++++++++++-----<br>
> criu/util.c | 5 +++++<br>
> 2 files changed, 15 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/criu/image.c b/criu/image.c<br>
> index 57d3c7b..384ee51 100644<br>
> --- a/criu/image.c<br>
> +++ b/criu/image.c<br>
> @@ -332,9 +332,14 @@ int do_open_remote_image(int dfd, char *path, int flags)<br>
> /* When using namespaces, the current dir is changed so we need to<br>
> * change to previous working dir and back to correctly open the image<br>
> * proxy and cache sockets. */<br>
> - int save = dirfd(opendir("."));<br>
> + DIR *save = opendir(".");<br>
> + if (save == NULL) {<br>
> + pr_error("unable to open current working directory");<br>
> + return -1;<br>
> + }<br>
> +<br>
> if (fchdir(get_service_fd(IMG_FD_<wbr>OFF)) < 0) {<br>
> - pr_debug("fchdir to dfd failed!\n");<br>
> + pr_error("fchdir to dfd failed");<br>
<br>
</span>I think you mean pr_perror ?<br>
<div><div class="h5"><br>
> return -1;<br>
> }<br>
><br>
> @@ -352,11 +357,11 @@ int do_open_remote_image(int dfd, char *path, int flags)<br>
> ret = write_remote_image_connection(<wbr>snapshot_id, path, O_WRONLY);<br>
> }<br>
><br>
> - if (fchdir(save) < 0) {<br>
> - pr_debug("fchdir to save failed!\n");<br>
> + if (fchdir(dirfd(save)) < 0) {<br>
> + pr_error("fchdir to saved dir failed");<br>
> return -1;<br>
> }<br>
> - close(save);<br>
> + closedir(save);<br>
><br>
> return ret;<br>
> }<br>
> diff --git a/criu/util.c b/criu/util.c<br>
> index 9fd8ba2..d33ce0e 100644<br>
> --- a/criu/util.c<br>
> +++ b/criu/util.c<br>
> @@ -522,6 +522,11 @@ int copy_file(int fd_in, int fd_out, size_t bytes)<br>
> char *buffer = (char*) malloc(chunk);<br>
> ssize_t ret;<br>
><br>
> + if (buffer == NULL) {<br>
> + pr_err("Failed to allocate buffer to copy file.\n");<br>
> + return -1;<br>
> + }<br>
> +<br>
> while (1) {<br>
> if (opts.remote) {<br>
> ret = read(fd_in, buffer, chunk);<br>
> --<br>
> 1.9.1<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> CRIU mailing list<br>
> <a href="mailto:CRIU@openvz.org">CRIU@openvz.org</a><br>
> <a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer" target="_blank">https://lists.openvz.org/<wbr>mailman/listinfo/criu</a><br>
</blockquote></div><br></div>