Re: basename(3) should have non-const arg, says POSIX

2020-10-19 Thread Todd C . Miller
On Mon, 19 Oct 2020 22:06:52 +0200, Christian Weisgerber wrote: > The patch below aligns the function prototypes with POSIX. All > resulting warnings "passing 'const char *' to parameter of type > 'char *' discards qualifiers" in the base system have been cleaned > up. It successfully passes

Re: basename(3) should have non-const arg, says POSIX

2020-10-19 Thread Stefan Sperling
On Mon, Oct 19, 2020 at 10:06:52PM +0200, Christian Weisgerber wrote: > [Picking this up again after a month:] > > Our basename(3) and dirname(3) take a const argument: > > char*basename(const char *); > char*dirname(const char *); > > POSIX says otherwise... > > char

basename(3) should have non-const arg, says POSIX

2020-10-19 Thread Christian Weisgerber
[Picking this up again after a month:] Our basename(3) and dirname(3) take a const argument: char*basename(const char *); char*dirname(const char *); POSIX says otherwise... char *basename(char *path); char *dirname(char *path); ... and explicitly says the functions may modify

Re: basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Christian Weisgerber
Todd C. Miller: > This is probably the right thing to do but we should fix the warnings > it generates. In this new world order, passing a const char * to > basename() or dirname() is unsafe. FWIW, here's the list: /usr/src/lib/libkvm/kvm.c:684:16: warning: passing 'const char *' to parameter

Re: basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Todd C . Miller
On Sat, 12 Sep 2020 17:05:02 +0200, Christian Weisgerber wrote: > A make build with the patch below succeeds, but gains some new > warnings "passing 'const char *' to parameter of type 'char *' > discards qualifiers". > > This is a portability trap. Code written on OpenBSD may not be > prepared

basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Christian Weisgerber
Our basename(3) and dirname(3) take a const argument: char*basename(const char *); char*dirname(const char *); POSIX says otherwise... char *basename(char *path); char *dirname(char *path); ... and explicitly says the functions may modify the input string. Our functions were