[systemd-devel] [PATCH 3/3] core: remove unneeded <libgen.h> include

Cristian Rodríguez crrodriguez at opensuse.org
Wed Feb 11 10:58:36 PST 2015


El 11/02/15 a las 14:26, Lennart Poettering escribió:
> On Wed, 11.02.15 18:21, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> So, hmm, so if I got this right:
>
> a) The good basame() is in strings.h
> b) The bad basename() is in libgen.h
> c) The only other call in libgen.h is dirname()

There is another problem to keep an eye on.. dirname() may modify its 
argument.. only the GNU basename() version never does, no such warranty 
exists for dirname. so dirname callers must strdup(a) just in case the 
library does something stupid behind our backs..

I was tempted to post a patch vanishing all uses of dirname() replacing 
it by dirname_malloc() ...






More information about the systemd-devel mailing list