2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 00:35:23 +00:00
Files
criu/pie/util.c
Andrey Vagin cb648fb934 pie: don't use pr_perror in pie code
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@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-30 16:44:16 +04:00

41 lines
689 B
C

#include <sys/socket.h>
#include <sys/un.h>
#include <sys/mount.h>
#include <errno.h>
#include "compiler.h"
#include "asm/string.h"
#include "asm/types.h"
#include "syscall.h"
#include "log.h"
#include "util-pie.h"
int open_detach_mount(char *dir)
{
int fd, ret;
fd = sys_open(dir, O_RDONLY | O_DIRECTORY, 0);
if (fd < 0)
pr_err("Can't open directory %s: %d\n", dir, fd);
ret = sys_umount2(dir, MNT_DETACH);
if (ret) {
pr_perror("Can't detach mount %s: %d\n", dir, ret);
goto err_close;
}
ret = sys_rmdir(dir);
if (ret) {
pr_perror("Can't remove tmp dir %s: %d\n", dir, ret);
goto err_close;
}
return fd;
err_close:
if (fd >= 0)
sys_close(fd);
return -1;
}