Skip to content

Commit 1dab218

Browse files
committed
Avoid passing signed chars to <ctype.h> functions ... same old
portability mistake as always. Per buildfarm member pika.
1 parent f121c40 commit 1dab218

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bin/psql/command.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.228 2010/08/14 14:20:35 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.229 2010/08/25 00:53:37 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -2452,20 +2452,21 @@ strip_lineno_from_funcdesc(char *func)
24522452
*/
24532453

24542454
/* skip trailing whitespace */
2455-
while (c > func && isascii(*c) && isspace(*c))
2455+
while (c > func && isascii((unsigned char) *c) && isspace((unsigned char) *c))
24562456
c--;
24572457

24582458
/* must have a digit as last non-space char */
2459-
if (c == func || !isascii(*c) || !isdigit(*c))
2459+
if (c == func || !isascii((unsigned char) *c) || !isdigit((unsigned char) *c))
24602460
return -1;
24612461

24622462
/* find start of digit string */
2463-
while (c > func && isascii(*c) && isdigit(*c))
2463+
while (c > func && isascii((unsigned char) *c) && isdigit((unsigned char) *c))
24642464
c--;
24652465

24662466
/* digits must be separated from func name by space or closing paren */
24672467
/* notice also that we are not allowing an empty func name ... */
2468-
if (c == func || !isascii(*c) || !(isspace(*c) || *c == ')'))
2468+
if (c == func || !isascii((unsigned char) *c) ||
2469+
!(isspace((unsigned char) *c) || *c == ')'))
24692470
return -1;
24702471

24712472
/* parse digit string */

0 commit comments

Comments
 (0)