Re: [PATCH] avoid assuming MAXPATHLEN in config(8)
2011/7/7 Ed Schouten <email@example.com>:
> * Robert Millan <firstname.lastname@example.org>, 20110707 11:33:
>> config(8) assumes MAXPATHLEN is defined in a few places, but presence
>> of this macro isn't garanteed (POSIX says that it is only present when
>> a file length limit exists, which may not be the case).
> Even though it is good to make our code conform to standards as much as
> possible, do keep in mind that your patch also causes a lot of
> regressions in that area. The code now uses asprintf(), which is not
> part of POSIX. I also think the use of __GLIBC__ is frowned upon.
Uhm... you're right. Actually I knew asprintf() is not part of POSIX,
it just didn't occur to me that this contradicted my point about
As for the __GLIBC__ bit, it is difficult to handle this without a
function that canonicalizes arbitrary-length pathnames. Would you
prefer something like:
// use realpath on a statically-allocated buffer
// assume canonicalize_file_name() is present
 Btw, POSIX itself is quite contradictory too: it doesn't let you
assume MAXPATHLEN, but it doesn't give you the facilities you need in
case it isn't present (e.g. asprintf and canonicalize_file_name but
gethostname and getline / fgetln come to mind too).