[CRIU] [PATCH 2/3] pie: don't use pr_perror in pie code

Andrey Vagin avagin at openvz.org
Thu Aug 29 03:31:08 EDT 2013


pr_perror uses errno, which is set by glibc wrappers.
In pi return codes of syscalls should be printed

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 pie/util.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/pie/util.c b/pie/util.c
index fe3fe4f..51f2aae 100644
--- a/pie/util.c
+++ b/pie/util.c
@@ -152,19 +152,21 @@ int recv_fds(int sock, int *fds, int nr_fds, struct fd_opts *opts)
 
 int open_detach_mount(char *dir)
 {
-	int fd;
+	int fd, ret;
 
 	fd = sys_open(dir, O_RDONLY | O_DIRECTORY, 0);
 	if (fd < 0)
-		pr_perror("Can't open directory");
+		pr_err("Can't open directory %s: %d\n", dir, fd);
 
-	if (sys_umount2(dir, MNT_DETACH)) {
-		pr_perror("Can't detach mount");
+	ret = sys_umount2(dir, MNT_DETACH);
+	if (ret) {
+		pr_perror("Can't detach mount %s: %d\n", dir, ret);
 		goto err_close;
 	}
 
-	if (sys_rmdir(dir)) {
-		pr_perror("Can't remove tmp dir");
+	ret = sys_rmdir(dir);
+	if (ret) {
+		pr_perror("Can't remove tmp dir %s: %d\n", dir, ret);
 		goto err_close;
 	}
 
-- 
1.8.3.1



More information about the CRIU mailing list