From: gilles Date: Sat, 17 Oct 2015 19:44:07 +0000 (+0000) Subject: makemap shout strip initial and trailing whitespaces using strip() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cd29edca4e429078e7b095db88a20ae7328d2850;p=openbsd makemap shout strip initial and trailing whitespaces using strip() ok millert@, ok jung@ --- diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index f54bd57b41c..bc5020c7fe3 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.54 2015/10/12 07:58:19 deraadt Exp $ */ +/* $OpenBSD: makemap.c,v 1.55 2015/10/17 19:44:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -385,7 +385,6 @@ make_aliases(DBT *val, char *text) { struct expandnode xn; char *subrcpt; - char *endp; char *origtext; val->data = NULL; @@ -394,17 +393,11 @@ make_aliases(DBT *val, char *text) origtext = xstrdup(text, "make_aliases"); while ((subrcpt = strsep(&text, ",")) != NULL) { - /* subrcpt: strip initial whitespace. */ - while (isspace((unsigned char)*subrcpt)) - ++subrcpt; + /* subrcpt: strip initial and trailing whitespace. */ + subrcpt = strip(subrcpt); if (*subrcpt == '\0') goto error; - /* subrcpt: strip trailing whitespace. */ - endp = subrcpt + strlen(subrcpt) - 1; - while (subrcpt < endp && isspace((unsigned char)*endp)) - *endp-- = '\0'; - if (! text_to_expandnode(&xn, subrcpt)) goto error; }