Added SILC Server library.
[silc.git] / lib / silcutil / unix / silcunixutil.c
index 75a6adcabf7c262471f89179e6fdd20d99dc8f3e..15356c52b92b474f40b0f5e01c27a709920ad948 100644 (file)
@@ -22,7 +22,7 @@
  */
 /* $Id$ */
 
-#include "silcincludes.h"
+#include "silc.h"
 
 /* XXX lib/contrib/regex.c might cmopile on WIN32 as well */
 
@@ -98,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)
@@ -176,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);
+}
+