* path.cc (path_conv::check): Fix problem reading symlinks introduced in below
change by reverting the change and adding an additional test for nonexistent files in /proc.
This commit is contained in:
parent
c6a00dcbb9
commit
2e98459145
|
@ -1,3 +1,9 @@
|
||||||
|
2005-04-20 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* path.cc (path_conv::check): Fix problem reading symlinks introduced
|
||||||
|
in below change by reverting the change and adding an additional test
|
||||||
|
for nonexistent files in /proc.
|
||||||
|
|
||||||
2005-04-20 Christopher Faylor <cgf@timesys.com>
|
2005-04-20 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* path.cc (path_conv::check): Punt when attempting to access a
|
* path.cc (path_conv::check): Punt when attempting to access a
|
||||||
|
|
|
@ -531,7 +531,7 @@ path_conv::check (const char *src, unsigned opt,
|
||||||
symlink_info sym;
|
symlink_info sym;
|
||||||
bool need_directory = 0;
|
bool need_directory = 0;
|
||||||
bool saw_symlinks = 0;
|
bool saw_symlinks = 0;
|
||||||
int is_relpath;
|
bool is_relpath;
|
||||||
char *tail, *path_end;
|
char *tail, *path_end;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -646,25 +646,33 @@ path_conv::check (const char *src, unsigned opt,
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
fileattr = FILE_ATTRIBUTE_DIRECTORY;
|
if (component == 0)
|
||||||
|
fileattr = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
fileattr = 0;
|
if (component == 0)
|
||||||
|
fileattr = 0;
|
||||||
break;
|
break;
|
||||||
case -2: /* /proc/self or /proc/<pid>/symlinks */
|
case -2: /* /proc/self or /proc/<pid>/symlinks */
|
||||||
goto is_virtual_symlink;
|
goto is_virtual_symlink;
|
||||||
case -3: /* /proc/<pid>/fd/pipe:[] */
|
case -3: /* /proc/<pid>/fd/pipe:[] */
|
||||||
fileattr = 0;
|
if (component == 0)
|
||||||
dev.parse (FH_PIPE);
|
{
|
||||||
|
fileattr = 0;
|
||||||
|
dev.parse (FH_PIPE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case -4: /* /proc/<pid>/fd/socket:[] */
|
case -4: /* /proc/<pid>/fd/socket:[] */
|
||||||
fileattr = 0;
|
if (component == 0)
|
||||||
dev.parse (FH_TCP);
|
{
|
||||||
|
fileattr = 0;
|
||||||
|
dev.parse (FH_TCP);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fileattr = INVALID_FILE_ATTRIBUTES;
|
if (component == 0)
|
||||||
error = ENOENT;
|
fileattr = INVALID_FILE_ATTRIBUTES;
|
||||||
break;
|
goto virtual_component_retry;
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -794,7 +802,6 @@ is_virtual_symlink:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual_component_retry:
|
virtual_component_retry:
|
||||||
|
|
||||||
/* Find the new "tail" of the path, e.g. in '/for/bar/baz',
|
/* Find the new "tail" of the path, e.g. in '/for/bar/baz',
|
||||||
/baz is the tail. */
|
/baz is the tail. */
|
||||||
if (tail != path_end)
|
if (tail != path_end)
|
||||||
|
@ -877,6 +884,11 @@ out:
|
||||||
/* nothing to do */;
|
/* nothing to do */;
|
||||||
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
path_flags &= ~PATH_SYMLINK;
|
path_flags &= ~PATH_SYMLINK;
|
||||||
|
else if (isvirtual_dev (dev.devn) && fileattr == INVALID_FILE_ATTRIBUTES)
|
||||||
|
{
|
||||||
|
error = ENOENT;
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_printf ("%s is a non-directory", path);
|
debug_printf ("%s is a non-directory", path);
|
||||||
|
|
Loading…
Reference in New Issue