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: Thu, 21 Jun 2001 00:10:34 -0400 (EDT)

How about this version?  I don't like the looking up "." paradigm.


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/21 04:09:22
@@ -333,12 +333,20 @@ diskfs_S_dir_lookup (struct protid *dirc
     if (diskfs_read_symlink_hook)
         error = (*diskfs_read_symlink_hook)(np, pathbuf);
           if (!diskfs_read_symlink_hook || error == EINVAL)
+              {
                   error = diskfs_node_rdwr (np, pathbuf,
                                                  0, np->dn_stat.st_size,
                                                  0,
                                                                              
dircred,
                                                                              
&amt);
+
                                                                                
    if
                                                                                
    (!error)
+
                                                                                
        assert
                                                                                
        (amt
                                                                                
        ==
                                                                                
        np->dn_stat.st_size);
+
                                                                                
            }
                                                                                
              if
                                                                                
              (error)
                                                                                
                  goto
                                                                                
                  out;
 
+         if (np->dn_stat.st_size == 0) /* symlink to "" */
+             path = nextname;
+               else
+                   {
                      if (nextname)
                          {
                                pathbuf[np->dn_stat.st_size] = '/';
@@ -355,8 +363,9 @@ diskfs_S_dir_lookup (struct protid *dirc
         strcpy (retryname, pathbuf);
               goto out;
                   }
-
          path = pathbuf;
+             }
+
          if (lastcomp)
              {
                    lastcomp = 0;
@@ -364,8 +373,16 @@ diskfs_S_dir_lookup (struct protid *dirc
           creation, so clear the flag here. */
                 create = 0;
                     }
+
          diskfs_nput (np);
            np = 0;
+
+         if (path == 0)        /* symlink to "" was the last component */
+             {
+                   np = dnp;
+                         dnp = 0;
+                               break;
+                                   }
                                    }
       else
       {



reply via email to

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