From 49a4c1509ec80de1db1d5f32b4d130b49a355d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 1 Apr 2012 20:45:19 +0000 Subject: [PATCH] Fix a bug detected by the unit tests: to ensure consistent handling of trailing whitespace, openpam_readword() should *always* push back the last character read (which is a no-op in the EOF case). git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@550 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- lib/openpam_readword.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/openpam_readword.c b/lib/openpam_readword.c index 4a8839f..8a78e9c 100644 --- a/lib/openpam_readword.c +++ b/lib/openpam_readword.c @@ -118,8 +118,7 @@ openpam_readword(FILE *f, int *lineno, size_t *lenp) errno = EINVAL; return (NULL); } - if (ch == '\n') - ungetc(ch, f); + ungetc(ch, f); if (lenp != NULL) *lenp = len; return (word);