[PATCH:xman 4/4] Use snprintf to PATH_MAX sized buffers to construct filenames
Alan Coopersmith
alan.coopersmith at oracle.com
Wed Feb 2 08:26:37 PST 2011
On 02/ 1/11 10:41 PM, Guillem Jover wrote:
> Hi!
>
> On Fri, 2011-01-28 at 23:14:00 -0800, Alan Coopersmith wrote:
>> diff --git a/misc.c b/misc.c
>> index 0921307..8818aa8 100644
>> --- a/misc.c
>> +++ b/misc.c
>> @@ -693,7 +693,7 @@ ConstructCommand(cmdbuf, path, filename, tempfile)
>> FILE *file;
>> char fmtbuf[128];
>> int gotfmt = 0; /* set to 1 if we got a directive from source */
>> - char *fname = NULL;
>> + char fname[PATH_MAX];
>> #ifdef __UNIXOS2__
>> int i;
>> #endif
>
> POSIX does not mandate for a system w/o such limit to define PATH_MAX,
> so this will make the build fail there (an example of such a system
> could be GNU/Hurd).
Of course you point this out after the patch is pushed...
If any actual system runs into this theoretical problem, I'll happily
accept a patch to add
#ifndef PATH_MAX
# define PATH_MAX 1024 /* Any man page path longer than this deserves not to load */
#endif
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list