From 497a9a2032bc93b616294dbe00494475416d8bd3 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 4 Jun 2006 00:15:56 +0000 Subject: [PATCH] in ngetdelim(), set errno to EINVAL if stream is not a valid file stream; this matches the manual page git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3617 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/utils.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b476f610..1d176e5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -333,6 +333,9 @@ CVS code - - Unconditionally blank the statusbar as soon as we're finished getting input. (DLR, suggested by Benno Schulenberg) - utils.c: + ngetdelim() + - Set errno to EINVAL if stream is not a valid file stream. + This matches the manual page. (DLR) nperror() - Simplify. (DLR) - winio.c: diff --git a/src/utils.c b/src/utils.c index 70601b3d..10a4baba 100644 --- a/src/utils.c +++ b/src/utils.c @@ -197,7 +197,8 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream) int c; /* Sanity checks. */ - if (lineptr == NULL || n == NULL || stream == NULL) { + if (lineptr == NULL || n == NULL || stream == NULL || + fileno(stream) == -1) { errno = EINVAL; return -1; } -- 2.39.5