[CRIU] [PATCH 2/9] util: set cr_errno to ESRCH if no PID dir in proc

Ruslan Kuprieiev kupruser at gmail.com
Thu Dec 11 12:55:11 PST 2014


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 include/cr-errno.h | 5 +++++
 util.c             | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/include/cr-errno.h b/include/cr-errno.h
index ccea5cd..b8d27d2 100644
--- a/include/cr-errno.h
+++ b/include/cr-errno.h
@@ -4,4 +4,9 @@
 void set_cr_errno(int err);
 int get_cr_errno(void);
 
+/*
+ * List of symbolic error names:
+ * ESRCH	- no process can be found corresponding to that specified by pid
+ */
+
 #endif /* __CR_ERRNO_H__ */
diff --git a/util.c b/util.c
index dd76863..1dc07f2 100644
--- a/util.c
+++ b/util.c
@@ -42,6 +42,8 @@
 #include "servicefd.h"
 #include "cr-service.h"
 
+#include "cr-errno.h"
+
 #define VMA_OPT_LEN	128
 
 static void vma_opt_str(const struct vma_area *v, char *opt)
@@ -268,6 +270,7 @@ inline int open_pid_proc(pid_t pid)
 	fd = openat(dfd, path, O_RDONLY);
 	if (fd < 0) {
 		pr_perror("Can't open %s", path);
+		set_cr_errno(ESRCH);
 		return -1;
 	}
 
-- 
1.9.3



More information about the CRIU mailing list