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 |
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 |
} |
} |
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); |
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 |
|
|
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 |
|
|