/[hurd]/hurd/libdiskfs/dir-lookup.c
ViewVC logotype

Diff of /hurd/libdiskfs/dir-lookup.c

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

revision 1.48 by marcus, Mon Oct 29 23:24:54 2001 UTC revision 1.49 by roland, Sat Dec 8 18:29:48 2001 UTC
# Line 1  Line 1 
1  /* libdiskfs implementation of fs.defs:dir_lookup  /* libdiskfs implementation of fs.defs:dir_lookup
2     Copyright (C) 1992,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc.     Copyright (C) 1992,93,94,95,96,97,98,99,2000,01
3            Free Software Foundation, Inc.
4    
5     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
6     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 286  diskfs_S_dir_lookup (struct protid *dirc Line 287  diskfs_S_dir_lookup (struct protid *dirc
287                *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND;                *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND;
288                if (!lastcomp && !error)                if (!lastcomp && !error)
289                  {                  {
290                    strcat (retryname, "/");                    char *end = strchr (retryname, '\0');
291                    strcat (retryname, nextname);                    *end++ = '/';
292                      strcpy (end, nextname);
293                  }                  }
294                return error;                return error;
295              }              }
# Line 323  diskfs_S_dir_lookup (struct protid *dirc Line 325  diskfs_S_dir_lookup (struct protid *dirc
325              }              }
326    
327            nextnamelen = nextname ? strlen (nextname) + 1 : 0;            nextnamelen = nextname ? strlen (nextname) + 1 : 0;
328            newnamelen = nextnamelen + np->dn_stat.st_size + 1;            newnamelen = nextnamelen + np->dn_stat.st_size + 1 + 1;
329            if (pathbuflen < newnamelen)            if (pathbuflen < newnamelen)
330              {              {
331                pathbuf = alloca (newnamelen);                pathbuf = alloca (newnamelen);
# Line 350  diskfs_S_dir_lookup (struct protid *dirc Line 352  diskfs_S_dir_lookup (struct protid *dirc
352                if (nextname)                if (nextname)
353                  {                  {
354                    pathbuf[np->dn_stat.st_size] = '/';                    pathbuf[np->dn_stat.st_size] = '/';
355                    bcopy (nextname, pathbuf + np->dn_stat.st_size + 1,                    memcpy (pathbuf + np->dn_stat.st_size + 1,
356                           nextnamelen - 1);                            nextname, nextnamelen - 1);
357                  }                  }
358                pathbuf[nextnamelen + np->dn_stat.st_size] = '\0';                pathbuf[nextnamelen + np->dn_stat.st_size] = '\0';
359    
# Line 360  diskfs_S_dir_lookup (struct protid *dirc Line 362  diskfs_S_dir_lookup (struct protid *dirc
362                    /* Punt to the caller.  */                    /* Punt to the caller.  */
363                    *retry = FS_RETRY_MAGICAL;                    *retry = FS_RETRY_MAGICAL;
364                    *returned_port = MACH_PORT_NULL;                    *returned_port = MACH_PORT_NULL;
365                    strcpy (retryname, pathbuf);                    memcpy (retryname, pathbuf,
366                              nextnamelen + np->dn_stat.st_size + 1);
367                      if (mustbedir)
368                        {
369                          retryname[nextnamelen + np->dn_stat.st_size] = '/';
370                          retryname[nextnamelen + np->dn_stat.st_size + 1] = '\0';
371                        }
372                    goto out;                    goto out;
373                  }                  }
374    
375                path = pathbuf;                path = pathbuf;
376              }              }
377    

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

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