[PATCH] reimplement dirname v2

Matthias Andree mandree at FreeBSD.org
Sun Sep 11 14:45:50 UTC 2011


Am 11.09.2011 09:55, schrieb Tito:

> There are also two more problems of different behaviour
> between linux and freebsd:
> 1) freebsd dirname could return NULL on error

This is a standards conformance bug to be addressed inside FreeBSD.

FreeBSD's dirname() claims conformance to X/Open Issue 4 Rev 2, which
isn't exactly up to date.

> 2) It errors on path component to be returned larger than MAXPATHLEN
>   meanwhile linux dirname swallows happily args larger than PATH_MAX
>   (could not find MAXPATHLEN for linux so I assume it is PATH_MAX for us).

> Even if this could happen only on corner cases it could eventually interact badly
> with bb's code as we don't expect dirname to return NULL, at least the manpages
> don't mention it.

You should not need to, and note that few applications will continue to
work much longer if they've run out of memory.


More information about the busybox mailing list