Borken dirname on Solaris 2.5.1

Alex Kiernan alexk at demon.net
Thu Oct 25 01:15:07 EST 2001


Discovered this post an upgrade to 2.9.9p2, Solaris 2.5.1 dirname is
busted for paths like "/usr", returning "" rather than "/".

Index: acconfig.h
===================================================================
RCS file: /cvsroot/upstream/openssh/acconfig.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 acconfig.h
--- acconfig.h	2001/10/23 15:18:33	1.1.1.3
+++ acconfig.h	2001/10/24 15:09:49
@@ -333,6 +333,9 @@
 /* Define if you want smartcard support */
 #undef SMARTCARD
 
+/* Define if your dirname is busted */
+#undef BROKEN_DIRNAME
+
 @BOTTOM@
 
 /* ******************* Shouldn't need to edit below this line ************** */
Index: configure.in
===================================================================
RCS file: /cvsroot/upstream/openssh/configure.in,v
retrieving revision 1.5
diff -u -r1.5 configure.in
--- configure.in	2001/10/23 16:26:00	1.5
+++ configure.in	2001/10/24 15:09:49
@@ -531,6 +531,23 @@
 	)
 fi
 
+# Check for broken dirname (Solaris 2.5.1)
+AC_MSG_CHECKING([whether dirname works correctly for the root directory])
+AC_TRY_RUN(
+	[
+#include <string.h>
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+int main(void){char buf[5];strcpy(buf,"/usr");return strlen(dirname(buf))==0;}
+	],
+	[AC_MSG_RESULT(yes)], 
+	[
+		AC_MSG_RESULT(no)
+		AC_DEFINE(BROKEN_DIRNAME)
+	]
+)
+
 AC_FUNC_GETPGRP
 
 # Check for PAM libs
Index: openbsd-compat/dirname.c
===================================================================
RCS file: /cvsroot/upstream/openssh/openbsd-compat/dirname.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 dirname.c
--- openbsd-compat/dirname.c	2001/10/23 15:18:35	1.1.1.1
+++ openbsd-compat/dirname.c	2001/10/24 15:09:49
@@ -28,6 +28,11 @@
  */
 
 #include "includes.h"
+
+#if defined(BROKEN_DIRNAME)		/* For those with broken dirname() */
+# undef HAVE_DIRNAME
+#endif
+
 #ifndef HAVE_DIRNAME
 
 #if defined(LIBC_SCCS) && !defined(lint)

-- 
Alex Kiernan, Principal Engineer, Development, Thus PLC



More information about the openssh-unix-dev mailing list