From b1af0c69d967a117564093814adebfc352019a06 Mon Sep 17 00:00:00 2001 From: short <> Date: Sat, 6 Dec 2003 23:17:26 +0000 Subject: [PATCH 1/1] Fixed captive_storage_relastblock() invoked in sandbox slave. --- src/libcaptive/storage/iounixchannel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcaptive/storage/iounixchannel.c b/src/libcaptive/storage/iounixchannel.c index 1bf3f6a..df104b8 100644 --- a/src/libcaptive/storage/iounixchannel.c +++ b/src/libcaptive/storage/iounixchannel.c @@ -39,7 +39,12 @@ int r; int fd; fd=open("/dev/null",O_RDONLY); - g_return_val_if_fail(fd!=-1,-1); + /* We may be already chroot()ed. + * We would be called from captive_storage_relastblock() + * and it is safe to return -1 in such case. + */ + if (fd==-1) + return -1; iochannel_null=g_io_channel_unix_new(fd); g_return_val_if_fail(iochannel_null!=NULL,-1); } -- 1.8.3.1