commit 979e4999367d29323c0e59d4b915177095af6d7b parent d9da87668f04dba7c164f2dab044a5858933b741 Author: Christian Grothoff <christian@grothoff.org> Date: Mon, 18 Jan 2016 21:41:49 +0000 -check rval before fstat'ing Diffstat:
| M | src/examples/demo_https.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c @@ -699,8 +699,9 @@ generate_page (void *cls, ('/' != url[1]) ) { fd = open (&url[1], O_RDONLY); - if ( (0 != fstat (fd, &buf)) || - (! S_ISREG (buf.st_mode)) ) + if ( (-1 != fd) && + ( (0 != fstat (fd, &buf)) || + (! S_ISREG (buf.st_mode)) ) ) { (void) close (fd); fd = -1;