[Libguestfs] [PATCH] common/mlutils: fix f_type comparisons
Richard W.M. Jones
rjones at redhat.com
Wed Oct 11 15:25:02 UTC 2017
On Wed, Oct 11, 2017 at 04:37:09PM +0200, Pino Toscano wrote:
> statfs::f_type is usually a signed type, so cast it to unsigned to check
> its value against magic values of filesystems.
> ---
> common/mlutils/unix_utils-c.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/common/mlutils/unix_utils-c.c b/common/mlutils/unix_utils-c.c
> index f8c4f8abe..2afdc9e5f 100644
> --- a/common/mlutils/unix_utils-c.c
> +++ b/common/mlutils/unix_utils-c.c
> @@ -357,9 +357,9 @@ guestfs_int_mllib_statvfs_is_network_filesystem (value pathv)
> #define SMB_SUPER_MAGIC 0x517b
> #endif
>
> - return Val_bool (buf.f_type == CIFS_MAGIC_NUMBER ||
> - buf.f_type == NFS_SUPER_MAGIC ||
> - buf.f_type == SMB_SUPER_MAGIC);
> + return Val_bool ((unsigned int) buf.f_type == CIFS_MAGIC_NUMBER ||
> + (unsigned int) buf.f_type == NFS_SUPER_MAGIC ||
> + (unsigned int) buf.f_type == SMB_SUPER_MAGIC);
> #else
> return Val_bool (0);
> #endif
ACK. Can you add the commit hash that this fixes to the commit message.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list