* pop3d/retr.c (pop3_retr): Typo.
* pop3d/top.c (pop3_top): No need to reallocate when sending the headers.
Showing
2 changed files
with
8 additions
and
13 deletions
... | @@ -56,7 +56,7 @@ pop3_retr (const char *arg) | ... | @@ -56,7 +56,7 @@ pop3_retr (const char *arg) |
56 | while (stream_readline (stream, buf, buflen, off, &n) == 0 | 56 | while (stream_readline (stream, buf, buflen, off, &n) == 0 |
57 | && n > 0) | 57 | && n > 0) |
58 | { | 58 | { |
59 | /* Nuke the trainline newline. */ | 59 | /* Nuke the trailing newline. */ |
60 | if (buf[n - 1] == '\n') | 60 | if (buf[n - 1] == '\n') |
61 | buf[n - 1] = '\0'; | 61 | buf[n - 1] = '\0'; |
62 | else /* Make room for the line. */ | 62 | else /* Make room for the line. */ | ... | ... |
... | @@ -67,23 +67,18 @@ pop3_top (const char *arg) | ... | @@ -67,23 +67,18 @@ pop3_top (const char *arg) |
67 | if (buf == NULL) | 67 | if (buf == NULL) |
68 | pop3_abquit (ERR_NO_MEM); | 68 | pop3_abquit (ERR_NO_MEM); |
69 | off = n = 0; | 69 | off = n = 0; |
70 | while (stream_readline (stream, buf, buflen, off, &n) == 0) | 70 | while (stream_readline (stream, buf, buflen, off, &n) == 0 |
71 | && n > 0) | ||
71 | { | 72 | { |
72 | if (n == 0) | ||
73 | break; | ||
74 | /* Nuke the trainline newline. */ | 73 | /* Nuke the trainline newline. */ |
75 | if (buf[n - 1] == '\n') | 74 | if (buf[n - 1] == '\n') |
76 | buf [n - 1] = '\0'; | ||
77 | else /* Make room for the line. */ | ||
78 | { | 75 | { |
79 | buflen *= 2; | 76 | buf[n - 1] = '\0'; |
80 | buf = realloc (buf, buflen * sizeof (*buf)); | 77 | fprintf (ofile, "%s\r\n", buf); |
81 | if (buf == NULL) | ||
82 | pop3_abquit (ERR_NO_MEM); | ||
83 | continue; | ||
84 | } | 78 | } |
79 | else | ||
80 | fprintf (ofile, "%s", buf); | ||
85 | off += n; | 81 | off += n; |
86 | fprintf (ofile, "%s\r\n", buf); | ||
87 | } | 82 | } |
88 | 83 | ||
89 | /* Lines of body. */ | 84 | /* Lines of body. */ |
... | @@ -95,7 +90,7 @@ pop3_top (const char *arg) | ... | @@ -95,7 +90,7 @@ pop3_top (const char *arg) |
95 | while (stream_readline (stream, buf, buflen, off, &n) == 0 | 90 | while (stream_readline (stream, buf, buflen, off, &n) == 0 |
96 | && n > 0 && lines > 0) | 91 | && n > 0 && lines > 0) |
97 | { | 92 | { |
98 | /* Nuke the trainline newline. */ | 93 | /* Nuke the trailing newline. */ |
99 | if (buf[n - 1] == '\n') | 94 | if (buf[n - 1] == '\n') |
100 | buf[n - 1] = '\0'; | 95 | buf[n - 1] = '\0'; |
101 | else /* make room for the line. */ | 96 | else /* make room for the line. */ | ... | ... |
-
Please register or sign in to post a comment