aboutsummaryrefslogtreecommitdiff
path: root/printutils/lpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'printutils/lpd.c')
-rw-r--r--printutils/lpd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/printutils/lpd.c b/printutils/lpd.c
index 79119a47f..43c22948f 100644
--- a/printutils/lpd.c
+++ b/printutils/lpd.c
@@ -236,6 +236,9 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[])
236 fd = xopen(queue, O_RDWR | O_APPEND); 236 fd = xopen(queue, O_RDWR | O_APPEND);
237 } 237 }
238 238
239 // signal OK
240 safe_write(STDOUT_FILENO, "", 1);
241
239 // copy the file 242 // copy the file
240 real_len = bb_copyfd_size(STDIN_FILENO, fd, expected_len); 243 real_len = bb_copyfd_size(STDIN_FILENO, fd, expected_len);
241 if (real_len != expected_len) { 244 if (real_len != expected_len) {
@@ -243,7 +246,7 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[])
243 expected_len, real_len); 246 expected_len, real_len);
244 goto err_exit; 247 goto err_exit;
245 } 248 }
246 // get ACK and see whether it is NUL (ok) 249 // get EOF indicator, see whether it is NUL (ok)
247 // (and don't trash s[0]!) 250 // (and don't trash s[0]!)
248 if (safe_read(STDIN_FILENO, &s[1], 1) != 1 || s[1] != 0) { 251 if (safe_read(STDIN_FILENO, &s[1], 1) != 1 || s[1] != 0) {
249 // don't send error msg to peer - it obviously 252 // don't send error msg to peer - it obviously
@@ -262,6 +265,9 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[])
262 265
263 free(s); 266 free(s);
264 close(fd); // NB: can do close(-1). Who cares? 267 close(fd); // NB: can do close(-1). Who cares?
268
269 // NB: don't do "signal OK" write here, it will be done
270 // at the top of the loop
265 } // while (1) 271 } // while (1)
266 272
267 err_exit: 273 err_exit: