quando la pipe in ingresso non contiene dati, se non lo si usa in quel
caso {{{tee}}} ritorna semplicemente con un valore nullo.
/* tee loop */
while (1) {
/* copy stdin to stdout */
/* tee loop */
while (1) {
/* copy stdin to stdout */
- len = tee(STDIN_FILENO, STDOUT_FILENO, size, SPLICE_F_NONBLOCK);
+ len = tee(STDIN_FILENO, STDOUT_FILENO, size, 0);
+ fprintf(stderr, "Copied %d byte\n", len); /* debug (use stderr!) */
if (len == 0) break;
if (len < 0) {
if (errno == EAGAIN) {
if (len == 0) break;
if (len < 0) {
if (errno == EAGAIN) {
- fprintf(stderr, "Copied %d byte\n", len); /* debug (use stderr!) */
/* write data to the file using splice */
while (len > 0) {
nwrite = splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
/* write data to the file using splice */
while (len > 0) {
nwrite = splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);