From a478d0a0a5b599e6c7df2af4128c98006f857b68 Mon Sep 17 00:00:00 2001 From: martijn <> Date: Mon, 1 Oct 2018 06:37:37 +0000 Subject: As per POSIX, when str{,r}chr is comparing it should convert c to a char. The C implementation of str{,r}chr are not linked to the build, because assembly implementations are used, but change to code for easier reference. At least the i386 and amd64 are checked and seem to do the correct thing. Found thanks to the csh any/strchr change. minor pointers and OK millert@ --- src/lib/libc/string/strrchr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/libc/string/strrchr.c') diff --git a/src/lib/libc/string/strrchr.c b/src/lib/libc/string/strrchr.c index 9375572144..848d1ad22e 100644 --- a/src/lib/libc/string/strrchr.c +++ b/src/lib/libc/string/strrchr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: strrchr.c,v 1.4 2018/10/01 06:37:37 martijn Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -38,7 +38,7 @@ strrchr(const char *p, int ch) char *save; for (save = NULL;; ++p) { - if (*p == ch) + if (*p == (char) ch) save = (char *)p; if (!*p) return(save); -- cgit v1.2.3-55-g6feb