Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / lib / sh / pathcanon.c
index d74f99c..3b427a8 100644 (file)
 #include <bashansi.h>
 #include <stdio.h>
 #include <chartypes.h>
+#include <errno.h>
 
 #include "shell.h"
 
+#if !defined (errno)
+extern int errno;
+#endif
+
 #if defined (__CYGWIN__)
 #include <sys/cygwin.h>
 
@@ -73,6 +78,8 @@ _path_isdir (path)
   int l;
   struct stat sb;
 
+  /* This should leave errno set to the correct value. */
+  errno = 0;
   l = stat (path, &sb) == 0 && S_ISDIR (sb.st_mode);
 #if defined (__CYGWIN__)
   if (l == 0)