Re: [PATCH man-pages] open.2: improve O_PATH documentation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Do, 10.08.17 13:25, NeilBrown (neilb@xxxxxxxx) wrote:

> +If
> +.I pathname
> +refers to an automount point that has not yet been triggered, so no
> +other filesystem is mounted on it, then the call returns a file
> +descriptor referring to the automount directory without triggering a mount.
> +.BR fstatfs (2)
> +can then be used to determine if it is, in fact, an untriggered
> +automount point
> +.RB ( ".f_type == AUTOFS_SUPER_MAGIC" ).

Because Linux is broken you shouldn't compare f_type just like this,
and the man page probably shouldn't suggest that either I figure. The
only safe way is something like this:

     s.f_type == (typeof(s.f_type)) AUTOFS_SUPER_MAGIC

That's because f_type is defined with different types (both signed and
unsigned) on different archs, and the magic values tend to use the
full unsigned 32bit range...

(Yes, strictly speaking AUTOFS_SUPER_MAGIC isn't one of the unsigned
32bit ones, but I think it's better to stick the same rules for all
magic values comparisons here...)

(And yes, the statfs() man page only mentions the problem briefly,
without the typeof way out, but it really should)

Lennart

-- 
Lennart Poettering, Red Hat
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux