util: set cr_errno to ESRCH if no PID dir in proc

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Ruslan Kuprieiev 2014-12-11 22:55:11 +02:00 committed by Pavel Emelyanov
parent ef283e505c
commit b09a88b5f9
2 changed files with 8 additions and 0 deletions

View file

@ -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__ */

3
util.c
View file

@ -43,6 +43,8 @@
#include "cr-service.h"
#include "files.h"
#include "cr-errno.h"
#define VMA_OPT_LEN 128
static void vma_opt_str(const struct vma_area *v, char *opt)
@ -274,6 +276,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;
}