X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Funix%2Fsilcunixutil.c;h=15356c52b92b474f40b0f5e01c27a709920ad948;hb=40f8443d8d3a6577336ee66d18e04d9ac4d956bb;hp=592661649d4ded3542bb414027626201755773b5;hpb=f4bfb2bd7a663acfff720ee901463d370266a9c5;p=silc.git diff --git a/lib/silcutil/unix/silcunixutil.c b/lib/silcutil/unix/silcunixutil.c index 59266164..15356c52 100644 --- a/lib/silcutil/unix/silcunixutil.c +++ b/lib/silcutil/unix/silcunixutil.c @@ -4,12 +4,11 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2001 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,7 +22,7 @@ */ /* $Id$ */ -#include "silcincludes.h" +#include "silc.h" /* XXX lib/contrib/regex.c might cmopile on WIN32 as well */ @@ -99,7 +98,7 @@ int silc_string_regex_match(const char *regex, const char *string) regex_t preg; int ret = FALSE; - if (regcomp(&preg, regex, REG_NOSUB | REG_EXTENDED) < 0) + if (regcomp(&preg, regex, REG_NOSUB | REG_EXTENDED) != 0) return FALSE; if (regexec(&preg, string, 0, NULL, 0) == 0) @@ -177,3 +176,9 @@ int silc_gettimeofday(struct timeval *p) { return gettimeofday(p, NULL); } + +int silc_file_set_nonblock(int fd) +{ + return fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); +} +