diff options
author | wtc%google.com <devnull@localhost> | 2008-09-18 00:30:07 +0000 |
---|---|---|
committer | wtc%google.com <devnull@localhost> | 2008-09-18 00:30:07 +0000 |
commit | c996188024c684915690db34893b40a1ecacaa27 (patch) | |
tree | dd714e5406c5ff178126e369b4108c127346ead3 | |
parent | 520766016de45e3492ab0d8ddacd6b6b17d99cbf (diff) | |
parent | 7c94cf617a842d353def0bf2fdb8c5908f6ea47d (diff) | |
download | nss-hg-c996188024c684915690db34893b40a1ecacaa27.tar.gz |
Bug 454961: pr_fgets should return NULL if it reaches EOF before reading
any data. This matches the behavior of fgets. Removed an accidental use
of the comma operator in util.c and a test that's no longer necessary with
the change to pr_fgets. r=alexei.volkov.
Modified Files:
signtool.c util.c
-rw-r--r-- | security/nss/cmd/signtool/signtool.c | 2 | ||||
-rw-r--r-- | security/nss/cmd/signtool/util.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/security/nss/cmd/signtool/signtool.c b/security/nss/cmd/signtool/signtool.c index a55bddaa1..881a4e92d 100644 --- a/security/nss/cmd/signtool/signtool.c +++ b/security/nss/cmd/signtool/signtool.c @@ -185,7 +185,7 @@ ProcessCommandFile() return - 1; } - while (pr_fgets(buf, CMD_FILE_BUFSIZE, fd), buf && *buf != '\0') { + while (pr_fgets(buf, CMD_FILE_BUFSIZE, fd)) { char *eol; linenum++; diff --git a/security/nss/cmd/signtool/util.c b/security/nss/cmd/signtool/util.c index 7da4a661d..be780d29b 100644 --- a/security/nss/cmd/signtool/util.c +++ b/security/nss/cmd/signtool/util.c @@ -1109,10 +1109,13 @@ pr_fgets(char *buf, int size, PRFileDesc *file) i = 0; while (i < size - 1) { - status = PR_Read(file, (void * ) &c, 1); + status = PR_Read(file, &c, 1); if (status == -1) { return NULL; } else if (status == 0) { + if (i == 0) { + return NULL; + } break; } buf[i++] = c; |