bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "" as target of symlink kills translator


From: Roland McGrath
Subject: Re: "" as target of symlink kills translator
Date: Tue, 19 Jun 2001 18:35:56 -0400 (EDT)

I have a change that pleases me aesthetically.  Can you tell me if this
works?  (The indentation in the patch is all messed up by cut&paste in this
message.)

Index: dir-lookup.c
===================================================================
RCS file: /cvs/hurd/libdiskfs/dir-lookup.c,v
retrieving revision 1.46
diff -u -b -p -r1.46 dir-lookup.c
--- dir-lookup.c     2001/06/16 20:23:09        1.46
+++ dir-lookup.c     2001/06/19 22:34:54
@@ -338,7 +338,12 @@ diskfs_S_dir_lookup (struct protid *dirc
                           dircred, &amt);
                             if (error)
                                 goto out;
+                                  assert (amt == np->dn_stat.st_size);
 
+         if (np->dn_stat.st_size == 0) /* symlink to "" */
+             path = nextname ?: "";
+               else
+                   {
                      if (nextname)
                          {
                                pathbuf[np->dn_stat.st_size] = '/';
@@ -355,8 +360,9 @@ diskfs_S_dir_lookup (struct protid *dirc
         strcpy (retryname, pathbuf);
               goto out;
                   }
-
          path = pathbuf;
+             }
+
          if (lastcomp)
              {
                    lastcomp = 0;
@@ -364,8 +370,14 @@ diskfs_S_dir_lookup (struct protid *dirc
           creation, so clear the flag here. */
                 create = 0;
                     }
+
          diskfs_nput (np);
            np = 0;
+
+         /* A symlink to "" just loops back to the containing directory,
+              so that is a valid value for PATH right now.  Short-circuit
+                   the end-of-loop test.  */
+                     continue;
                      }
       else
       {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]