On 10/19/19 1:59 AM, Jarno Mäkipää wrote: > In order to be used as drop in replacement for dirname() > > If path is a null pointer or points to an empty string, > dirname() shall return a pointer to the string "." .
Applied, but it's not a drop-in replacement because it returns a malloc() and the other either modifies its input string (!) or returns a static ".". I made getdirname() because A) modifying your input argument is rude, B) I needed to do getbasename() anyway (which glibc has two versions of that behave differently, depending on which header you include first) and I wanted a getdirname() with the same semantics as that. Unfortunately, I misremembered getbasename()'s semantics, and it's _not_ returning a malloc. It's just returning either strrchr(name, '.')+1 or name if there's no '/'; So my cp cleannup segfaulted until I moved the free() back under the if (FLAG(D)) and now I want to fix the semantics to be consistent and I'm tempted to rip getdirname back _out_ except modifying your argument is still unfortunate... (Sorry, I'm getting a bit overwhelmed juggling as many patches and bug reports as I'm getting. I cut the release, but I still need to track down the tar bug report, and I think I've dropped at least one of Elliott's xargs patches, there's trailing ls spaces, people keep doing github comments instead of mailing list stuff which get dropped on the floor regularly because there's no obvious replacement for a mailing list archive there...) Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net