[CRIU] [PATCH 02/15] rst: Don't use write_img_buf for setting last_pid sysctl

Pavel Emelyanov xemul at parallels.com
Mon Sep 29 01:47:05 PDT 2014


The write_img_buf will be used only for images writing, while
in this place we just have a raw file descriptor.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-restore.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index a903ab2..9277433 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1050,6 +1050,7 @@ static inline int fork_with_pid(struct pstree_item *item)
 
 	if (!(ca.clone_flags & CLONE_NEWPID)) {
 		char buf[32];
+		int len;
 
 		ca.fd = open_proc_rw(PROC_GEN, LAST_PID_PATH);
 		if (ca.fd < 0) {
@@ -1063,8 +1064,8 @@ static inline int fork_with_pid(struct pstree_item *item)
 			goto err;
 		}
 
-		snprintf(buf, sizeof(buf), "%d", pid - 1);
-		if (write_img_buf(ca.fd, buf, strlen(buf)))
+		len = snprintf(buf, sizeof(buf), "%d", pid - 1);
+		if (write(ca.fd, buf, len) != len)
 			goto err_unlock;
 	} else {
 		ca.fd = -1;
-- 
1.8.4.2




More information about the CRIU mailing list