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
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
[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
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
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
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