From: Richard Jones Date: Fri, 4 Jun 2010 10:45:06 +0000 (+0100) Subject: file: Restrict to regular files (RHBZ#582484). X-Git-Tag: 1.3.19~1 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=4df593496e116dfb635731c058b7627e81fc179c;hp=4df593496e116dfb635731c058b7627e81fc179c;ds=sidebyside file: Restrict to regular files (RHBZ#582484). 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. ---