From: jca Date: Wed, 8 Jan 2014 17:31:36 +0000 (+0000) Subject: If the file size is zero, there's nothing to transmit so avoid spamming X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=aa8037be325bcf13995676a9d8a199c96a61e540;p=openbsd If the file size is zero, there's nothing to transmit so avoid spamming syslog with mmap failures. Noticed by and ok henning@, "looks right" deraadt@ --- diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index fc523178ee7..7bb51247f4c 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.198 2013/08/22 04:43:40 guenther Exp $ */ +/* $OpenBSD: ftpd.c,v 1.199 2014/01/08 17:31:36 jca Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -1586,6 +1586,12 @@ send_data(FILE *instr, FILE *outstr, off_t blksize, off_t filesize, int isreg) if (isreg && filesize < (off_t)16 * 1024 * 1024) { size_t fsize = (size_t)filesize; + if (fsize == 0) { + transflag = 0; + reply(226, "Transfer complete."); + return(0); + } + buf = mmap(0, fsize, PROT_READ, MAP_SHARED, filefd, (off_t)0); if (buf == MAP_FAILED) {