[lxc-devel] [lxcfs/master] fix read_file second reading empty bug

yinhongbo on Github lxc-bot at linuxcontainers.org
Tue Oct 15 07:58:09 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 2905 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191015/ed13997f/attachment.bin>
-------------- next part --------------
From 030d022c5f1adfa7acdbb6deb5aad82d9580181d Mon Sep 17 00:00:00 2001
From: Hongbo Yin <yinhongbo at bytedance.com>
Date: Tue, 15 Oct 2019 15:39:58 +0800
Subject: [PATCH] fix read_file second reading empty bug

Signed-off-by: Hongbo Yin <yinhongbo at bytedance.com>
---
 bindings.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bindings.c b/bindings.c
index 1811955..234574e 100644
--- a/bindings.c
+++ b/bindings.c
@@ -3382,6 +3382,8 @@ int read_file(const char *path, char *buf, size_t size, struct file_info *d)
   err:
 	fclose(f);
 	free(line);
+	if (d->size > rv)
+		d->cached = d->size - rv;
 	return rv;
 }
 


More information about the lxc-devel mailing list