summaryrefslogtreecommitdiff
path: root/comsat/action.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-02-08 14:18:25 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-02-08 14:18:25 +0000
commit88b95232237d4cc43cc49a4371931ea1b7a8a2b7 (patch)
treebacd8c3c740bc67d5b5257c924220c45bb509ecd /comsat/action.c
parent689db9610e36f7e8c2035447b4d05d29906f4945 (diff)
downloadmailutils-88b95232237d4cc43cc49a4371931ea1b7a8a2b7.tar.gz
mailutils-88b95232237d4cc43cc49a4371931ea1b7a8a2b7.tar.bz2
(act_getline): Bugfix. Do not return eof on an empty line. Reported by Damon Harper.
Diffstat (limited to 'comsat/action.c')
-rw-r--r--comsat/action.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/comsat/action.c b/comsat/action.c
index 2b4dba3e1..727870c83 100644
--- a/comsat/action.c
+++ b/comsat/action.c
@@ -48,17 +48,20 @@ act_getline (FILE *fp, char **sptr, size_t *size)
size_t used = 0;
unsigned lines = 0;
+ if (feof (fp))
+ return 0;
+
while (cont && fgets (buf, sizeof buf, fp))
{
int len = strlen (buf);
if (buf[len-1] == '\n')
{
+ lines++;
buf[--len] = 0;
if (buf[len-1] == '\\')
{
buf[--len] = 0;
cont = 1;
- lines++;
}
else
cont = 0;
@@ -80,8 +83,6 @@ act_getline (FILE *fp, char **sptr, size_t *size)
if (*sptr)
(*sptr)[used] = 0;
- if (used && !feof (fp))
- lines++;
return lines;
}

Return to:

Send suggestions and report system problems to the System administrator.