Fixed captive_storage_relastblock() invoked in sandbox slave.
authorshort <>
Sat, 6 Dec 2003 23:17:26 +0000 (23:17 +0000)
committershort <>
Sat, 6 Dec 2003 23:17:26 +0000 (23:17 +0000)
src/libcaptive/storage/iounixchannel.c

index 1bf3f6a..df104b8 100644 (file)
@@ -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);
                }