From 2abde7a3f34399b1ca6164d04c94447d39bb94f6 Mon Sep 17 00:00:00 2001 From: Vladimir Rutsky Date: Mon, 1 Feb 2016 00:35:34 +0300 Subject: [PATCH] fix use of assert() when NDEBUG is defined assert() body is not executed if NDEBUG is defined. --- buse.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/buse.c b/buse.c index 69039b7..3cd3a27 100644 --- a/buse.c +++ b/buse.c @@ -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. */