$OpenBSD: patch-base_src_common_OS_unix-path_c,v 1.1 2002/08/28 22:23:29 todd Exp $
--- base/src/common/OS/unix-path.c.orig	Thu Jul 18 20:30:50 2002
+++ base/src/common/OS/unix-path.c	Wed Aug 28 14:26:40 2002
@@ -305,15 +305,30 @@ path_portstat(const char *fname, portsta
 
   memset(ps, 0, sizeof(*ps));
 
-  result = stat(fname, &sb);
+  /* Use "lstat" here so we don't traverse any symlinks! Originally we
+     used just "stat", and ran into interesting results as OpenCM
+     tried to follow the symlinks to their targets. */
+  result = lstat(fname, &sb);
   if (result == -1) {
     if (errno == ENOENT) {
       ps->exists = FALSE;
       return;
     }
-
-    THROW(ExNoObject,
-	  format("Could not stat path [%s]: errno %d", fname, errno));
+    /* A component of the path is not a directory:
+         We don't want to just ignore this, because 'update' will fail when it
+         tries to write to something inside the "directory". But making the
+         error message more descriptive is nice, so users can understand what
+         is wrong, and hopefully how to fix it (that may be a bit of a stretch,
+         but whatever)
+    */
+    else if (errno == ENOTDIR) {
+      THROW(ExNoObject,
+            format("One or more components of %s is not a directory", fname));
+    }
+    else {
+      THROW(ExNoObject,
+            format("Could not stat path [%s]: errno %d", fname, errno));
+    }
   }
 
   ps->exists = TRUE;
