Always use openpam_straddch(3) to bootstrap the string, even if we
have nothing to add to it. This simplifies the code and fixes a bug introduced in r553 where the first character in the string would always be set to '\0', instead of only when bootstrapping. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@636 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
75420a1e07
commit
f8a727ec0c
|
@ -85,13 +85,8 @@ openpam_readword(FILE *f, int *lineno, size_t *lenp)
|
|||
/* begin quote */
|
||||
quote = ch;
|
||||
/* edge case: empty quoted string */
|
||||
if (word == NULL && (word = malloc(1)) == NULL) {
|
||||
openpam_log(PAM_LOG_ERROR, "malloc(): %m");
|
||||
errno = ENOMEM;
|
||||
if (openpam_straddch(&word, &size, &len, 0) != 0)
|
||||
return (NULL);
|
||||
}
|
||||
*word = '\0';
|
||||
size = 1;
|
||||
} else if (ch == quote && !escape) {
|
||||
/* end quote */
|
||||
quote = 0;
|
||||
|
|
Loading…
Reference in New Issue