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

Ruslan Kuprieiev kupruser at gmail.com
Tue Dec 2 04:29:39 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 6ca6c68..bec72a8 100644
--- a/include/cr-errno.h
+++ b/include/cr-errno.h
@@ -1,4 +1,9 @@
 #ifndef __CR_ERRNO_H__
 #define __CR_ERRNO_H__
 extern int cr_errno;
+/*
+ * 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..7b38351 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);
+		cr_errno = ESRCH;
 		return -1;
 	}
 
-- 
1.9.3



More information about the CRIU mailing list