Merge pull request #4 from rutsky/fix-when-NDEBUG-defined

fix behaviour when BUSE compiled with defined NDEBUG
This commit is contained in:
Adam Cozzette 2016-02-08 21:43:19 -08:00
commit 48c8f20d92
2 changed files with 7 additions and 3 deletions

9
buse.c
View File

@ -91,13 +91,16 @@ int buse_main(const char* dev_file, const struct buse_operations *aop, void *use
struct nbd_reply reply;
void *chunk;
assert(!socketpair(AF_UNIX, SOCK_STREAM, 0, sp));
err = socketpair(AF_UNIX, SOCK_STREAM, 0, sp);
assert(!err);
nbd = open(dev_file, O_RDWR);
assert(nbd != -1);
assert(ioctl(nbd, NBD_SET_SIZE, aop->size) != -1);
assert(ioctl(nbd, NBD_CLEAR_SOCK) != -1);
err = ioctl(nbd, NBD_SET_SIZE, aop->size);
assert(err != -1);
err = ioctl(nbd, NBD_CLEAR_SOCK);
assert(err != -1);
if (!fork()) {
/* The child needs to continue setting things up. */

View File

@ -96,6 +96,7 @@ int main(int argc, char *argv[])
/* Figure out the size of the underlying block device. */
err = ioctl(fd, BLKGETSIZE64, &size);
assert(err != -1);
(void)err;
fprintf(stderr, "The size of this device is %ld bytes.\n", size);
bop.size = size;