X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=src%2Flibcaptive%2Fstorage%2Fiounixchannel.c;h=df104b81cfb8f02c7a27d19c63a90bc57b1b689f;hb=b1af0c69d967a117564093814adebfc352019a06;hp=1bf3f6a031de9c835d3e494d0f8b5d70061c72f2;hpb=869c77b74f91d5c6dc3e5778f80dd30e3d6e4b9a;p=captive.git 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); }