tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



On Tue, Sep 25, 2018 at 04:32:03PM +1000, Simon Burge wrote:
> 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)
> be able to be called on the results of a previous dirname(3) call in
> which case we should document this in the manpage?

dirname(3) and basename(3) can return the original buffer altered, 
or return static memory. The standard allows both behavior, and 
Linux uses the former while NetBSD uses the later. This is decade old
pain when porting software, 

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index