int fl = fcntl (sock, F_GETFL); if (fl != -1) fcntl (sock, F_SETFL, fl | O_NONBLOCK);
nscd_init (void){  struct sockaddr_un sock_addr;  size_t cnt;  /* Secure mode and unprivileged mode are incompatible */  if (server_user != NULL && secure_in_use)    {      dbg_log (_("Cannot run nscd in secure mode as unprivileged user"));      exit (1);    }  /* Look up unprivileged uid/gid/groups before we start listening on the     socket  */  if (server_user != NULL)    begin_drop_privileges ();  if (nthreads == -1)    /* No configuration for this value, assume a default.  */    nthreads = 2 * lastdb;  for (cnt = 0; cnt < lastdb; ++cnt)    if (dbs[cnt].enabled)      {	pthread_rwlock_init (&dbs[cnt].lock, NULL);	dbs[cnt].array = (struct hashentry **)	  calloc (dbs[cnt].module, sizeof (struct hashentry *));	if (dbs[cnt].array == NULL)	  {	    dbg_log (_("while allocating cache: %s"), strerror (errno));	    exit (1);	  }	if (dbs[cnt].check_file)	  {	    /* We need the modification date of the file.  */	    struct stat st;	    if (stat (dbs[cnt].filename, &st) < 0)	      {		/* We cannot stat() the file, disable file checking.  */		dbg_log (_("cannot stat() file `%s': %s"),			 dbs[cnt].filename, strerror (errno));		dbs[cnt].check_file = 0;	      }	    else	      dbs[cnt].file_mtime = st.st_mtime;	  }      }  /* Create the socket.  */  sock = socket (AF_UNIX, SOCK_STREAM, 0);  if (sock < 0)    {      dbg_log (_("cannot open socket: %s"), strerror (errno));      exit (1);    }  /* Bind a name to the socket.  */  sock_addr.sun_family = AF_UNIX;  strcpy (sock_addr.sun_path, _PATH_NSCDSOCKET);  if (bind (sock, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) < 0)    {      dbg_log ("%s: %s", _PATH_NSCDSOCKET, strerror (errno));      exit (1);    }  /* Set permissions for the socket.  */  chmod (_PATH_NSCDSOCKET, 0666);  /* Set the socket up to accept connections.  */  if (listen (sock, SOMAXCONN) < 0)    {      dbg_log (_("cannot enable socket to accept connections: %s"),	       strerror (errno));      exit (1);    }  /* Change to unprivileged uid/gid/groups if specifed in config file */  if (server_user != NULL)    finish_drop_privileges ();}