From: Laszlo Papp Date: Tue, 15 Mar 2011 08:33:08 +0000 (+0200) Subject: Check the return value properly before passing it to any function X-Git-Tag: fuse_2_9_0~64 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=61aff393dc414ae6650ba24a1012be0e7bcec5a0;p=qemu-gpiodev%2Flibfuse.git Check the return value properly before passing it to any function --- diff --git a/util/ulockmgr_server.c b/util/ulockmgr_server.c index 8ffdfef..583fcf9 100644 --- a/util/ulockmgr_server.c +++ b/util/ulockmgr_server.c @@ -366,8 +366,10 @@ int main(int argc, char *argv[]) } cfd = 4; nullfd = open("/dev/null", O_RDWR); - dup2(nullfd, 0); - dup2(nullfd, 1); + if (nullfd >= 0) { + dup2(nullfd, 0); + dup2(nullfd, 1); + } close(3); closefrom(5); while (1) {