Date: Tue, 1 Nov 2005 00:04:19 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 643 ************************************************** Monday 31 October 2005 Number 643 ************************************************** Subjects for today 1 Help me understand this code : Paul Smedley 2 Re: Help me understand this code : Tobias Huerlimann **= Email 1 ==========================** Date: Mon, 31 Oct 2005 21:35:22 +1030 From: Paul Smedley Subject: Help me understand this code Hi guys,. I'm trying to build the latest bind, currently it compiles but fails on running with this error: [E:\bind\bin]nslookup ibm.com socket.c:443: fcntl(20, F_SETFL, 6): Invalid argument nslookup: isc_socket_create: unexpected error The last parameter is obviously invalid for F_SETFL. The code in question is: make_nonblock(int fd) { int ret; int flags; char strbuf[ISC_STRERRORSIZE]; flags = fcntl(fd, F_GETFL, 0); flags |= O_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); if (ret == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "fcntl(%d, F_SETFL, %d): %s", fd, flags, strbuf); return (ISC_R_UNEXPECTED); } The line I don't understand is "flags |= O_NONBLOCK;" what does |= mean? Thanks in advance, Paul. **= Email 2 ==========================** Date: Mon, 31 Oct 2005 12:26:45 +0100 From: Tobias Huerlimann Subject: Re: Help me understand this code Paul Smedley wrote: > The line I don't understand is "flags |= O_NONBLOCK;" what does |= mean? It's a shortcut for: flags = flags | O_NONBLOCK; Tobias Hürlimann