delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/09/16/15:56:10

From: cgf AT cygnus DOT com (Christopher G. Faylor)
Subject: Re: Still symlink strangeness in snapshot
16 Sep 1998 15:56:10 GMT :
Message-ID: <6ton2q$5b8$1@cronkite.cygnus.com>
References: <19980916110023 DOT A11938 DOT cygnus DOT cygwin32 DOT developers AT cygnus DOT com>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <19980916110023 DOT A11938 DOT cygnus DOT cygwin32 DOT developers AT cygnus DOT com>,
Christopher Faylor <cgf AT cygnus DOT com> wrote:
>There are still problems with symlinks in the snapshot that Sergey's
>recent patch has helped unearth.  I'm working on fixing the problems
>and hope to have a patch soon.
>
>This is just a heads up for people so we don't duplicate effort.

The patch is below.  I was being overly aggressive in detecting
an error condition.  It kicked out symbolic links referring to
a drive's root directory.

Index: path.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/path.cc,v
retrieving revision 1.85
diff -u -p -r1.85 path.cc
--- path.cc	1998/09/16 03:49:52	1.85
+++ path.cc	1998/09/16 15:42:33
@@ -278,19 +278,20 @@ path_conv::path_conv (const char *src, i
 		}
 	      return;			// file found
 	    }
-	  if (len > 0 && component == 0)
+	  else if (len > 0)
 	    {
-	      symlink_p = 1;		// last component of path was a symlink.
-	      if (!follow_mode)
+	      if (component == 0)
 		{
-		  fileattr = attr;
-		  return;
+		  symlink_p = 1;	// last component of path was a symlink.
+		  if (!follow_mode)
+		    {
+		      fileattr = attr;
+		      return;
+		    }
 		}
+	      break;
 	    }
 
-	  if (len > 0 && (follow_mode || component > 0))
-	    break;			// symlink found
-
 	  s.reset ();			// remember this errno
 
 	  if (!(tail = strrchr (path_copy, '\\')) ||
@@ -331,8 +332,7 @@ path_conv::path_conv (const char *src, i
 	 and translate it back from MS-DOS mode to POSIX. */
       if (*sym_buf == '/' || *sym_buf == '\\')
 	src = sym_buf;
-      else if (!(tail = strrchr (path_copy, '\\')) ||
-	      (tail > path_copy && tail[-1] == ':'))
+      else if (!(tail = strrchr (path_copy, '\\')))
 	system_printf ("problem parsing %s - '%s'", src, full_path);
       else
 	{
-- 
cgf AT cygnus DOT com
http://www.cygnus.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019