{"action":"created","issue":{"url":"https://api.github.com/repos/simsong/tcpflow/issues/74","labels_url":"https://api.github.com/repos/simsong/tcpflow/issues/74/labels{/name}","comments_url":"https://api.github.com/repos/simsong/tcpflow/issues/74/comments","events_url":"https://api.github.com/repos/simsong/tcpflow/issues/74/events","html_url":"https://github.com/simsong/tcpflow/issues/74","id":31829831,"number":74,"title":"tcpflow prints \"write error to stdout\" after every packet","user":{"login":"dkogan","id":170011,"avatar_url":"https://avatars.githubusercontent.com/u/170011?v=3","gravatar_id":"","url":"https://api.github.com/users/dkogan","html_url":"https://github.com/dkogan","followers_url":"https://api.github.com/users/dkogan/followers","following_url":"https://api.github.com/users/dkogan/following{/other_user}","gists_url":"https://api.github.com/users/dkogan/gists{/gist_id}","starred_url":"https://api.github.com/users/dkogan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkogan/subscriptions","organizations_url":"https://api.github.com/users/dkogan/orgs","repos_url":"https://api.github.com/users/dkogan/repos","events_url":"https://api.github.com/users/dkogan/events{/privacy}","received_events_url":"https://api.github.com/users/dkogan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2014-04-18T22:43:07Z","updated_at":"2015-08-24T15:26:20Z","closed_at":"2014-04-18T22:50:15Z","body":"Hi. This is forwarded from debian bug report https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736417\r\n\r\nThis applies when tcpflow is invoked with -c.\r\n\r\nFrom: Frank Gevaerts <frank@gevaerts.be>\r\nTo: Debian Bug Tracking System <submit@bugs.debian.org>\r\nSubject: tcpflow prints \"write error to stdout\" after every packet\r\nDate: Thu, 23 Jan 2014 14:20:18 +0100\r\nPackage: tcpflow\r\nVersion: 1.4.4+repack1-2\r\nSeverity: normal\r\n\r\ntcpflow prints \"write error to stdout\" after every packet. This is printed when the expected length and the actually written length are different, in tcpip.c line 272.\r\nThe root cause is that the written length is not calculated correctly.\r\n\r\nOn line 265, written is incremented by the output of fputc(), which seems to be assumed to be 1 in case a character is successfully written. However, fputc() is defined as returning the character actually written. One solution would be:\r\n\r\n```\r\n--- tcpflow-1.4.4+repack1.orig/src/tcpip.cpp\r\n+++ tcpflow-1.4.4+repack1/src/tcpip.cpp\r\n@@ -262,7 +262,7 @@ void tcpip::print_packet(const u_char *d\r\n     else if(demux.opt.output_strip_nonprint){\r\n        for(const u_char *cc = data;cc<data+length;cc++){\r\n            if(isprint(*cc) || (*cc=='\\n') || (*cc=='\\r')){\r\n-               written += fputc(*cc,stdout);\r\n+               written += (fputc(*cc,stdout)!=EOF);\r\n            }\r\n        }\r\n     }\r\n```\r\n\r\nFrank\r\n"},"comment":{"url":"https://api.github.com/repos/simsong/tcpflow/issues/comments/134249181","html_url":"https://github.com/simsong/tcpflow/issues/74#issuecomment-134249181","issue_url":"https://api.github.com/repos/simsong/tcpflow/issues/74","id":134249181,"user":{"login":"simsong","id":1594284,"avatar_url":"https://avatars.githubusercontent.com/u/1594284?v=3","gravatar_id":"","url":"https://api.github.com/users/simsong","html_url":"https://github.com/simsong","followers_url":"https://api.github.com/users/simsong/followers","following_url":"https://api.github.com/users/simsong/following{/other_user}","gists_url":"https://api.github.com/users/simsong/gists{/gist_id}","starred_url":"https://api.github.com/users/simsong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simsong/subscriptions","organizations_url":"https://api.github.com/users/simsong/orgs","repos_url":"https://api.github.com/users/simsong/repos","events_url":"https://api.github.com/users/simsong/events{/privacy}","received_events_url":"https://api.github.com/users/simsong/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T15:26:20Z","updated_at":"2015-08-24T15:26:20Z","body":"Github tarballs don't have \"configure\" scripts, because they don't run autoconf.\n\n\n> On Aug 24, 2015, at 11:17 AM, Mike Dillon <notifications@github.com> wrote:\n> \n> Thanks @simsong <https://github.com/simsong>!\n> \n> Was there anything special about the source tarballs at Digital Corpora, or would it be a drop-in replacement to use the tarballs generated by GitHub? (e.g. https://github.com/simsong/tcpflow/archive/tcpflow-1.4.5.tar.gz <https://github.com/simsong/tcpflow/archive/tcpflow-1.4.5.tar.gz>)\n> \n> —\n> Reply to this email directly or view it on GitHub <https://github.com/simsong/tcpflow/issues/74#issuecomment-134244701>.\n> \n\n"}}