file: Restrict to regular files (RHBZ#582484).
authorRichard Jones <rjones@redhat.com>
Fri, 4 Jun 2010 10:45:06 +0000 (11:45 +0100)
committerRichard Jones <rjones@redhat.com>
Fri, 4 Jun 2010 14:07:27 +0000 (15:07 +0100)
The file call can hang if called on char devices (because we are
using the file -s option).

This is hard to solve cleanly without adding another file API.

However this restricts file to regular files, unless called explicitly
with a /dev/ path.  For non-regular files, it will now return a
string like "directory".

There is a small semantic change for symbolic links.  Previously
it would not have worked at all on absolute links (or rather, the
results would have been undefined).  It would have treated relative
symlinks to regular files as the regular file itself.  Now it will
return the string "symbolic link" in both cases.

This commit also makes the API safe when called on untrusted
filesystems.  Previously a filesystem might have been set up so
that (eg) /etc/redhat-release was a char device, which would have
caused virt-inspector and virt-v2v to hang.  Now it will not hang.


No differences found