Re: PATH_MAX (Re: [PATCH] system_path: use a static buffer)
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Mar 18, 2011, 11:54 UTC
- Message-ID
- <AANLkTimW9TofyEqZUQwkAkVqA_Sr5kgV_rm6dJ6LTVbb@mail.gmail.com>
- In-Reply-To
- <20110318113818.GA6049@elie>
On Fri, Mar 18, 2011 at 6:38 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Hi, > > Nguyen Thai Ngoc Duy wrote: > >> It was pointed out elsewhere [1] that PATH_MAX only specifies max >> length of a path element, not full path. I think we'd need to stay >> away from preallocated PATH_MAX-sized arrays. > > No, PATH_MAX is actually the maximum length of a path, and when you > use, say, open(2), it will fail if your path is longer than that. The > maximum length of a path component on most filesytems is 255 or 256; > PATH_MAX on Linux is 4096.
Hmm.. too late I sent two patches before reading this :) Cloning linux-2.6.git for verifying. But getcwd() can return a path longer than PATH_MAX, right?
-- Duy