[CRIU] [PATCH] net: Don't fail if there is no ip dump data
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 21 02:11:28 EDT 2013
If we met empy file just continue execution.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
net.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/net.c b/net.c
index 444f78e..33bd857 100644
--- a/net.c
+++ b/net.c
@@ -13,6 +13,9 @@
#include "crtools.h"
#include "sk-inet.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include "protobuf.h"
#include "protobuf/netdev.pb-c.h"
@@ -320,6 +323,18 @@ static int restore_ip_dump(int type, int pid, char *cmd)
ret = fd = open_image_ro(type, pid);
if (fd >= 0) {
+ struct stat st;
+
+ if (fstat(fd, &st)) {
+ pr_perror("Failed to obtain stat on file\n");
+ return -1;
+ } else if (st.st_size == 0) {
+ /*
+ * Empty file, just get out.
+ */
+ return 0;
+ }
+
ret = run_ip_tool(cmd, "restore", fd, -1);
close(fd);
}
--
1.8.1.4
More information about the CRIU
mailing list