]> andersk Git - openssh.git/blobdiff - openbsd-compat/bsd-misc.c
- (tim) [contrib/cygwin/ssh-host-config] Patch from Corinna Vinschen.
[openssh.git] / openbsd-compat / bsd-misc.c
index 56afa0975caeb06c97eadfac9c25104e4a2edd59..55f100ac04328624fee68e4763df1b864e2ea4e7 100644 (file)
  */
 
 #include "includes.h"
-#include "xmalloc.h"
 
-RCSID("$Id$");
+#include <sys/types.h>
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "xmalloc.h"
 
 #ifndef HAVE___PROGNAME
 char *__progname;
@@ -146,7 +158,8 @@ int nanosleep(const struct timespec *req, struct timespec *rem)
                tremain.tv_sec = 0;
                tremain.tv_usec = 0;
        }
-       TIMEVAL_TO_TIMESPEC(&tremain, rem)
+       if (rem != NULL)
+               TIMEVAL_TO_TIMESPEC(&tremain, rem)
 
        return(rc);
 }
@@ -223,10 +236,7 @@ strdup(const char *str)
        len = strlen(str) + 1;
        cp = malloc(len);
        if (cp != NULL)
-               if (strlcpy(cp, str, len) != len) {
-                       free(cp);
-                       return NULL;
-               }
-       return cp;
+               return(memcpy(cp, str, len));
+       return NULL;
 }
 #endif
This page took 0.042844 seconds and 4 git commands to generate.