[PATCH lib/libXfont] Provide a dummy readlink on WIN32

Jon TURNEY jon.turney at dronecode.org.uk
Tue Oct 23 06:18:49 PDT 2012


On 22/10/2012 16:25, Alan Coopersmith wrote:
> On 10/22/12 08:07 AM, Jon TURNEY wrote:
>> From: Ryan Pavlik <rpavlik-KgB/ygH5PX6Vc3sceRu5cw at public.gmane.org>
>>
>> Provide a dummy readlink, which just returns the supplied path name, on WIN32
>>
>> Signed-off-by: Ryan Pavlik <rpavlik-KgB/ygH5PX6Vc3sceRu5cw at public.gmane.org>
>> Reviewed-by: Jon TURNEY <jon.turney-GrJqePx9RPPAJUdA+FbntA at public.gmane.org>
>> ---
>>  src/fontfile/catalogue.c |    9 +++++++++
>>  1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c
>> index 8029b28..7ec06f2 100644
>> --- a/src/fontfile/catalogue.c
>> +++ b/src/fontfile/catalogue.c
>> @@ -37,6 +37,15 @@ static const char CataloguePrefix[] = "catalogue:";
>>  
>>  static int CatalogueFreeFPE (FontPathElementPtr fpe);
>>  
>> +#ifdef WIN32
>> +static int readlink(const char *path, char*buf, size_t bufsiz)
>> +{
>> +    /* Silly no-op implementation */
>> +    strncpy(buf, path, bufsiz);
> 
> Don't you want a buf[bufsiz - 1] = '\0' after that, just in case
> the caller passed something either not null terminated or too long
> to fit the null byte in the buf?

I'm not sure.

I can't find anything that says readlink() is supposed to behave like that,
and indeed the man page I have on linux for readlink explicitly says it does
not null terminate buf.

I think this patch is superseded, anyhow.


More information about the xorg-devel mailing list