[PATCH] realpath: SUSv4 compliant

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Nov 13 21:20:08 UTC 2009


On Fri, Nov 13, 2009 at 09:35:02AM +0100, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: uclibc-bounces at uclibc.org [mailto:uclibc-bounces at uclibc.org] On Behalf Of Bernhard Reutner-Fischer

>> diff --git a/libc/stdlib/realpath.c b/libc/stdlib/realpath.c
>> index 1a00c31..3c3a607 100644
>> --- a/libc/stdlib/realpath.c
>> +++ b/libc/stdlib/realpath.c
>> @@ -72,12 +65,13 @@ char got_path[];
>>  	/* Copy so that path is at the end of copy_path[] */
>>  	strcpy(copy_path + (PATH_MAX-1) - path_len, path);
>>  	path = copy_path + (PATH_MAX-1) - path_len;
>> +	allocated_path = got_path ? NULL : malloc(PATH_MAX);
>
>I may be blind, but as far as I can tell you never use 
>allocated_path for anything (except freeing it)...

right, that should have read
+	allocated_path = got_path ? NULL : (got_path = malloc(PATH_MAX));


More information about the uClibc mailing list