Bug 12622 - Incorrect strchr/strrchr/strchrnul prototype
Summary: Incorrect strchr/strrchr/strchrnul prototype
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.13
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-30 13:41 UTC by H.J. Lu
Modified: 2014-06-27 13:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2011-03-30 13:41:09 UTC
[hjl@gnu-4 tmp]$ cat x.c
#include <string.h>

char *foo(const char *filename) {
  char *splitpos;

  splitpos = strrchr(filename, '/');
  return splitpos;
}
[hjl@gnu-4 tmp]$ g++ x.c
x.c: In function \u2018char* foo(const char*)\u2019:
x.c:6:35: error: invalid conversion from \u2018const char*\u2019 to \u2018char*\u2019
[hjl@gnu-4 tmp]$
Comment 1 Jakub Jelinek 2011-03-30 13:43:32 UTC
THat is completely intentional, C++ says that strchr etc. is
const char *strchr (const char *, int);
char *strchr (char *, int);