[CRIU] [PATCH] kdat: Don't open /run/criu.kdat if doesn't exists

Radostin Stoyanov rstoyanov1 at gmail.com
Sun Jul 1 21:13:58 MSK 2018


When CRIU is called for a first time and the /run/criu.kdat file does
not exists, the following warning is shown:
        Warn  (criu/kerndat.c:847): Can't load /run/criu.kdat

This patch is replacing this warning with a more appropriate debug message.
        File /run/criu.kdat does not exist

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/kerndat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/criu/kerndat.c b/criu/kerndat.c
index 9b93487c..57a97886 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -842,6 +842,11 @@ static int kerndat_try_load_cache(void)
 {
 	int fd, ret;
 
+	if(access(KERNDAT_CACHE_FILE, F_OK) == -1) {
+		pr_debug("File %s does not exist\n", KERNDAT_CACHE_FILE);
+		return 1;
+	}
+
 	fd = open(KERNDAT_CACHE_FILE, O_RDONLY);
 	if (fd < 0) {
 		pr_warn("Can't load %s\n", KERNDAT_CACHE_FILE);
-- 
2.17.1



More information about the CRIU mailing list