2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

util: Make sure open successed

Opening /dev/null may fail, check for ret code.

CID 1168167

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2014-04-09 14:46:13 +04:00 committed by Pavel Emelyanov
parent 708abf40b8
commit 6df067c50a

4
util.c
View File

@ -597,6 +597,10 @@ int cr_daemon(int nochdir, int noclose)
int fd;
fd = open("/dev/null", O_RDWR);
if (fd < 0) {
pr_perror("Can't open /dev/null");
return -1;
}
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);