diff options
author | Denis Vlasenko | 2008-07-22 19:15:30 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-07-22 19:15:30 +0000 |
commit | c445758708e4ca033005b91703770c9d132ba378 (patch) | |
tree | 7ed5741309ceec4d742fa2df4a3243e81b30833c /printutils/lpd.c | |
parent | e99a92dc2f7d45904bf7635ccb97895839000729 (diff) | |
download | busybox-c445758708e4ca033005b91703770c9d132ba378.zip busybox-c445758708e4ca033005b91703770c9d132ba378.tar.gz |
lpd,lpr: send/receive ACKs after filenames, not only after file bodies.
lpqr_main 1114 1149 +35
lpd_main 748 768 +20
Diffstat (limited to 'printutils/lpd.c')
-rw-r--r-- | printutils/lpd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/printutils/lpd.c b/printutils/lpd.c index 79119a4..43c2294 100644 --- a/printutils/lpd.c +++ b/printutils/lpd.c @@ -236,6 +236,9 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) fd = xopen(queue, O_RDWR | O_APPEND); } + // signal OK + safe_write(STDOUT_FILENO, "", 1); + // copy the file real_len = bb_copyfd_size(STDIN_FILENO, fd, expected_len); if (real_len != expected_len) { @@ -243,7 +246,7 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) expected_len, real_len); goto err_exit; } - // get ACK and see whether it is NUL (ok) + // get EOF indicator, see whether it is NUL (ok) // (and don't trash s[0]!) if (safe_read(STDIN_FILENO, &s[1], 1) != 1 || s[1] != 0) { // don't send error msg to peer - it obviously @@ -262,6 +265,9 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[]) free(s); close(fd); // NB: can do close(-1). Who cares? + + // NB: don't do "signal OK" write here, it will be done + // at the top of the loop } // while (1) err_exit: |