commit efd6fce48b8421886d9345297e5fe67c4910e1a6
parent c306d5f0fc377e800d4e475587b5527c6fc8eee7
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Thu, 2 Mar 2023 01:14:21 +0000
Handle EOF in pop_read
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pop3.c b/pop3.c
@@ -1,4 +1,4 @@
-/* $Id: pop3.c,v 1.8 2023/02/08 20:44:44 jacob Exp $ */
+/* $Id: pop3.c,v 1.9 2023/03/02 01:14:21 jacob Exp $ */
/*
* Copyright (c) 2022 Jacob R. Edwards
@@ -177,8 +177,11 @@ pop_read(FILE *fp, char *buf, int size)
{
char *p;
- if (!fgets(buf, size, fp))
+ if (!fgets(buf, size, fp)) {
+ if (!errno)
+ errno = ECONNRESET;
return NULL;
+ }
p = pop_charcheck(buf);
if (strcmp(p, "\r\n") != 0) {