+
/*
* Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
*
*/
#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;
}
#endif /* HAVE_TRUNCATE */
-#if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP)
-/*
- * Cygwin setgroups should be a noop.
- */
-int
-setgroups(size_t size, const gid_t *list)
-{
- return (0);
-}
-#endif
-
#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP)
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);
}
}
#endif /* HAVE_TCSENDBREAK */
-#ifndef HAVE_CLOSEFROM
-int
-closefrom(int fd)
-{
- int i, result = 0, err = 0;
-
- for (i = fd; i < 128; i++)
- if (close(i) != 0) {
- err = errno;
- result = -1;
- }
- errno = err;
- return result;
-}
-#endif /* HAVE_CLOSEFROM */
-
mysig_t
mysignal(int sig, mysig_t act)
{
return (signal(sig, act));
#endif
}
+
+#ifndef HAVE_STRDUP
+char *
+strdup(const char *str)
+{
+ size_t len;
+ char *cp;
+
+ len = strlen(str) + 1;
+ cp = malloc(len);
+ if (cp != NULL)
+ return(memcpy(cp, str, len));
+ return NULL;
+}
+#endif