Solaris 10 compatability, try two
[exim.git] / src / OS / os.c-SunOS5
index e298f6d5452dc1ebb7d3e91edc10aab57b766428..8ad8c9380c360c4fccf9cff8355e9e0495da8763 100644 (file)
@@ -3,14 +3,25 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 2016 */
-/* Copyright (c) Jeremy Harris 2016 */
+/* Copyright (c) Jeremy Harris 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Solaris-specific code. This is concatenated onto the generic
 src/os.c file. */
 
-#ifdef MISSING_UNSETENV_3
+#if defined(MISSING_UNSETENV_3) && !defined(COMPILE_UTILITY)
 # include "setenv.c"
 #endif
 
+/* This is missing in Solaris 10, present in Solaris 11.
+A feature-test would be good. */
+
+char *
+strndup(const char * s, unsigned long n)
+{
+char * dest;
+if (!(dest = malloc(n))) return NULL;
+return strncpy(dest, s, n);
+}
+
 /* End of os.c-SunOS5 */