qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() inste


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
Date: Tue, 04 Feb 2014 06:12:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 02/04/2014 05:25 AM, Markus Armbruster wrote:

> Second guessing when a pathname is too long for a system call is not a
> good idea.  If it's too long, the system call will tell you.  As Dan
> noted, PATH_MAX is *not* a hard limit.
> 
>     {PATH_MAX}
>         Maximum number of bytes the implementation will store as a
>         pathname in a user-supplied buffer of unspecified size,
>         including the terminating null character. Minimum number the
>         implementation will accept as the maximum number of bytes in a
>         pathname.

Linux allows unbelievably long absolute names.  Jim Meyering proved with
coreutils that you can create an absolute name well over a megabyte in
length.  The trick is that you have to access it via relative names
where each relative name is PATH_MAX or less (that is, the Linux kernel
refuses to operate on more than a page at a time when doing file name
resolution), by using openat() and friends.  mkdirat() can create a
directory with an absolute name longer than PATH_MAX, even if mkdir() can't.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]