[PATCH] reimplement dirname v2

Tito farmatito at tiscali.it
Thu Sep 8 20:24:40 UTC 2011


On Thursday 08 September 2011 18:11:22 Matthias Andree wrote:
> If libc has a good dirname() implementation it should be used. Please
> make that configurable and have it default to off on (e)glibc and FreeBSD.

Hi,
not that I think that this will ever be checked in,
nonetheless it would be interesting to know
what exactly a good dirname implementation is :-)
I think that the rationale for an eventual checkin
of this code is that due to the fact that there are 
different implementations in different libcs
and even in the same libc, we want to stick with
one that works everywhere independently
of the libc used.
I wonder also how the FreeBSD dirname
plays with busybox code like this in install.c:

			if (opts & OPT_MKDIR_LEADING) {
				char *ddir = xstrdup(dest);
				bb_make_directory(dirname(ddir), 0755, FILEUTILS_RECUR);
				/* errors are not checked. copy_file
				 * will fail if dir is not created. */
				free(ddir);
			}

Wouldn't this leak memory with the freebsd dirname?

Ciao,
Tito


More information about the busybox mailing list