[PATCH v2] uclibc:fix basename modify the input path

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Jan 20 13:42:24 UTC 2015


On 24 September 2014 at 04:47, Wangyufen <wangyufen at huawei.com> wrote:
> From: Wang Yufen <wangyufen at huawei.com>
>
> I tested basename(path), path is "///", the basename(path) returned "/",
> but the input path also be modified to "/". It because in basename impl,
> "last[1] = 0;" modified the input path, I think that isn't correct.

This is perfectly legal.
See http://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html

   text   data    bss    dec    hex filename
    165      0      0    165     a5 libc/string/__xpg_basename.os
    113      0      0    113     71 libc/string/__xpg_basename.os.orig

Since the current behaviour is in accordance to the standard and your version
is way bigger i prefer to keep it as is.

Thanks anyway!


More information about the uClibc mailing list