diff --git a/src/libcrun/criu.c b/src/libcrun/criu.c index 2fbcf55258..6039be87bd 100644 --- a/src/libcrun/criu.c +++ b/src/libcrun/criu.c @@ -587,9 +587,10 @@ libcrun_container_checkpoint_linux_criu (libcrun_container_status_t *status, lib const char *dest_in_root; dest_in_root = chroot_realpath (rootfs, def->mounts[i]->destination, buf); - if (UNLIKELY (dest_in_root == NULL)) - return crun_make_error (err, errno, "unable to resolve external bind mount `%s` under rootfs", def->mounts[i]->destination); - dest_in_root += strlen (rootfs); + if (LIKELY (dest_in_root != NULL)) + dest_in_root += strlen (rootfs); + else + dest_in_root = def->mounts[i]->destination; ret = libcriu_wrapper->criu_add_ext_mount (dest_in_root, dest_in_root); if (UNLIKELY (ret < 0)) @@ -916,9 +917,10 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru const char *dest_in_root; dest_in_root = chroot_realpath (rootfs, def->mounts[i]->destination, buf); - if (UNLIKELY (dest_in_root == NULL)) - return crun_make_error (err, errno, "unable to resolve external bind mount `%s` under rootfs", def->mounts[i]->destination); - dest_in_root += strlen (rootfs); + if (LIKELY (dest_in_root != NULL)) + dest_in_root += strlen (rootfs); + else + dest_in_root = def->mounts[i]->destination; ret = libcriu_wrapper->criu_add_ext_mount (dest_in_root, def->mounts[i]->source); if (UNLIKELY (ret < 0))