Comment 2 for bug 1077838

Revision history for this message
Robert Collins (lifeless) wrote :

Quick code read - I think that this block:
    if (flags & NBD_FLAG_READ_ONLY) {
        int read_only = 1;
        TRACE("Setting readonly attribute");

        if (ioctl(fd, BLKROSET, (unsigned long) &read_only) < 0) {
            int serrno = errno;
            LOG("Failed setting read-only attribute");
            return -serrno;
        }
    }

in nbd.c should be
    {
        int read_only = 0;
        if (flags & NBD_FLAG_READ_ONLY)
            read_only = 1;
        TRACE("Setting readonly attribute");
        if (ioctl(fd, BLKROSET, (unsigned long) &read_only) < 0) {
            int serrno = errno;
            LOG("Failed setting read-only attribute");
            return -serrno;
        }
    }