From f3e5903536f80cb42ee6841f85e013284eb4c2fc Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 18 Jan 2015 10:27:42 -0800 Subject: makestrs: use strchr() instead of index() Besides being supported by more standards, strchr() has the important characteristic of having a prototype included in on Solaris so that 64-bit compiles know it returns a pointer, not an integer. (On Solaris, index() is only found in , for SunOS compatibility.) Without this fix, makestrs segfaulted in 64-bit builds on Solaris after commit f9baaf55ff8cbd4bf018a34f181eda30d03b20dc switched to . Signed-off-by: Alan Coopersmith Reviewed-by: Hans de Goede --- util/makestrs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/makestrs.c b/util/makestrs.c index ce0a0a3..2c4dcc8 100644 --- a/util/makestrs.c +++ b/util/makestrs.c @@ -583,7 +583,7 @@ static void DoLine(char *buf) int rlen; int len; - if ((right = index(buf, ' '))) + if ((right = strchr(buf, ' '))) *right++ = 0; else right = buf + 1; @@ -666,8 +666,8 @@ static char* DoComment (char *line) int len; /* assume that the first line with two '$' in it is the RCS tag line */ - if ((tag = index (line, '$')) == NULL) return NULL; - if ((eol = index (tag + 1, '$')) == NULL) return NULL; + if ((tag = strchr (line, '$')) == NULL) return NULL; + if ((eol = strchr (tag + 1, '$')) == NULL) return NULL; len = eol - tag; if ((ret = malloc (len)) == NULL) exit (1); -- cgit v1.2.3