Module Name:    src
Committed By:   kre
Date:           Mon Jul 24 12:34:46 UTC 2017

Modified Files:
        src/bin/sh: alias.c

Log Message:
PR bin/52348

Silence nuisance testing environments - avoid << of a negative number
(a signed char -- in a hash function, the result is irrelevant, as long
as it is repeatable).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/sh/alias.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/alias.c
diff -u src/bin/sh/alias.c:1.15 src/bin/sh/alias.c:1.16
--- src/bin/sh/alias.c:1.15	Wed Jun 18 18:17:30 2014
+++ src/bin/sh/alias.c	Mon Jul 24 12:34:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: alias.c,v 1.15 2014/06/18 18:17:30 christos Exp $	*/
+/*	$NetBSD: alias.c,v 1.16 2017/07/24 12:34:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)alias.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: alias.c,v 1.15 2014/06/18 18:17:30 christos Exp $");
+__RCSID("$NetBSD: alias.c,v 1.16 2017/07/24 12:34:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -268,8 +268,8 @@ hashalias(const char *p)
 {
 	unsigned int hashval;
 
-	hashval = *p << 4;
+	hashval = *(const unsigned char *)p << 4;
 	while (*p)
-		hashval+= *p++;
+		hashval += *p++;
 	return &atab[hashval % ATABSIZE];
 }

Reply via email to