* devices.h (_minor): Coerce argument to proper type before manipulating.
(_major): Ditto. (device::is_fs_special): New function. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Set the size to 0 for devices rather than reporting the size of the symlink. (fhandler_disk_file::readdir): Use is_fs_special to determine if .lnk should be stripped. * path.cc: Rename symlink_info::is_symlink to symlink_info::issymlink throughout. (symlink_info::isdevice): New field. (path_conv::check): Use 'isdevice' to determine if just-parsed entity is a device rather than relying on non-zero major/minor. (symlink_info::parse_device): Set isdevice to true if we've discovered a device. (symlink_info::check): Clear isdevice field prior to processing. Use isdevice to control debugging output. (symlink_info::set): Set isdevice to false. * path.h (path_conv::is_fs_special): New function. * devices.cc: Regenerate.
This commit is contained in:
@ -394,6 +394,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
||||
{
|
||||
buf->st_dev = dev ();
|
||||
buf->st_mode = dev ().mode;
|
||||
buf->st_size = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -413,6 +414,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
|
||||
{
|
||||
buf->st_dev = dev ();
|
||||
buf->st_mode = dev ().mode;
|
||||
buf->st_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1458,7 +1460,7 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
|
||||
strcpy (fbuf, dir->__d_dirname);
|
||||
strcpy (fbuf + strlen (fbuf) - 1, c);
|
||||
path_conv fpath (fbuf, PC_SYM_NOFOLLOW);
|
||||
if (fpath.issymlink () || fpath.isspecial ())
|
||||
if (fpath.issymlink () || fpath.is_fs_special ())
|
||||
c[len - 4] = '\0';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user