From: epg <> Date: Thu, 16 Jan 2003 20:40:57 +0000 (+0000) Subject: (strip_from): I added a comment about my confidence in the X-Git-Url: https://diplodocus.org/git/mdeliver/commitdiff_plain/5ca5cba2fc37eb992e9fc173aaccc92576479c52?ds=inline;hp=cbab192ba54fdeb51f62f514cc6e5eeba9b4e98f (strip_from): I added a comment about my confidence in the read-first-five-bytes or fail bit a long time ago, but never committed it. --- diff --git a/mdeliver.c b/mdeliver.c index 54884e9..f673597 100644 --- a/mdeliver.c +++ b/mdeliver.c @@ -153,6 +153,14 @@ strip_from(int fd, char *buf, char *fn) { ssize_t r; + /* Yes, read(2) can be interrupted and read fewer bytes than + * requested. However, i'm only asking for five bytes here. I + * have tested this program extensively and it handles large + * volumes of mail correctly every day on my systems. This holds + * up my original opinion that expecting to be able to get five + * bytes safely is not an unreasonable demand. If i can't get + * five measly bytes, something is probably wrong, so bomb. + */ r = read(STDIN_FILENO, buf, 5); if (r != 5) { save_errno( unlink(fn) );