Re: dirname(3) used on its own results?

2018-09-25 Thread Robert Elz
Date:Tue, 25 Sep 2018 08:44:59 + From:Emmanuel Dreyfus Message-ID: <20180925084459.gd25...@homeworld.netbsd.org> | What a pity they do that without introducing basename_r(). If that existed in some kind of wodespread use, that might have happened, otherwise,

Re: dirname(3) used on its own results?

2018-09-25 Thread Edgar Fuß
> But there's nothing in that bit that implies (to me!) > "You can't subsequently call dirname(3) on the results of > a previous call to dirname(3)". You are calling dirname() on an argument that may be destroyed by that very call. You are calling dirname() on a possibly invalid argument.

Re: dirname(3) used on its own results?

2018-09-25 Thread Simon Burge
Edgar =?iso-8859-1?B?RnXf?= wrote: > > or are we restricted by some standard from having dirname(3) > > be able to be called on the results of a previous dirname(3) call > Not exactly restricted from, but > This is not strictly a bug; it is explicitly allowed by > IEEE Std

Re: dirname(3) used on its own results?

2018-09-25 Thread Robert Elz
Date:Tue, 25 Sep 2018 16:32:03 +1000 From:Simon Burge Message-ID: <20180925063203.2b92920...@thoreau.thistledown.com.au> | Is the correct fix to use memmove(3) instead of memcpy(3) inside | dirname(3), or are we restricted by some standard from having dirname(3)

Re: dirname(3) used on its own results?

2018-09-25 Thread Edgar Fuß
> or are we restricted by some standard from having dirname(3) > be able to be called on the results of a previous dirname(3) call Not exactly restricted from, but This is not strictly a bug; it is explicitly allowed by IEEE Std 1003.1-2001 (``POSIX.1''). > in which case we

dirname(3) used on its own results?

2018-09-25 Thread Simon Burge
Hi folks, Should you be allowed to call dirname(3) on the results of a previous dirname(3) call? On NetBSD 8: thoreau 49994> cat dirtest.c #include #include #include #include int main(void) { char *p =