/[hurd]/hurd/trans/fakeroot.c
ViewVC logotype

Diff of /hurd/trans/fakeroot.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by marcus, Fri May 3 14:52:18 2002 UTC revision 1.3 by roland, Sun May 5 19:19:51 2002 UTC
# Line 324  netfs_attempt_lookup (struct iouser *use Line 324  netfs_attempt_lookup (struct iouser *use
324                        char *name, struct node **np)                        char *name, struct node **np)
325  {  {
326    error_t err;    error_t err;
327    int flags = O_RDWR|O_EXEC;    int flags;
328    file_t file = file_name_lookup_under (dir->nn->file, name,    const file_t dirfile = dir->nn->file;
329                                          flags | O_NOLINK, 0);    file_t file;
330    
331      /* We must unlock the directory before making RPCs to the underlying
332         filesystem in case they somehow wind up trying to refer back to one of
333         our nodes.  The DIRFILE port will not change or die as long as DIR
334         lives, and our caller holds a reference keeping it alive.  */
335      mutex_unlock (&dir->lock);
336    
337      flags = O_RDWR|O_EXEC;
338      file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
339    if (file == MACH_PORT_NULL && errno == EACCES)    if (file == MACH_PORT_NULL && errno == EACCES)
340      {      {
341        flags = O_RDWR;        flags = O_RDWR;
342        file = file_name_lookup_under (dir->nn->file, name, flags | O_NOLINK, 0);        file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
343      }      }
344    if (file == MACH_PORT_NULL && errno == EACCES)    if (file == MACH_PORT_NULL && errno == EACCES)
345      {      {
346        flags = O_READ|O_EXEC;        flags = O_READ|O_EXEC;
347        file = file_name_lookup_under (dir->nn->file, name, flags | O_NOLINK, 0);        file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
348      }      }
349    if (file == MACH_PORT_NULL && errno == EACCES)    if (file == MACH_PORT_NULL && errno == EACCES)
350      {      {
351        flags = O_READ;        flags = O_READ;
352        file = file_name_lookup_under (dir->nn->file, name, flags | O_NOLINK, 0);        file = file_name_lookup_under (dirfile, name, flags | O_NOLINK, 0);
353      }      }
354    *np = 0;    *np = 0;
355    if (file == MACH_PORT_NULL)    if (file == MACH_PORT_NULL)
# Line 372  netfs_attempt_lookup (struct iouser *use Line 381  netfs_attempt_lookup (struct iouser *use
381              }              }
382          }          }
383      }      }
384    mutex_unlock (&dir->lock);  
385    if (*np)    if (*np)
386      mutex_lock (&(*np)->lock);      mutex_lock (&(*np)->lock);
387    return err;    return err;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26