From owner-freebsd-bugs Tue Jan 22 8: 0:22 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 9C20937B404 for ; Tue, 22 Jan 2002 08:00:06 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0MG06E22218; Tue, 22 Jan 2002 08:00:06 -0800 (PST) (envelope-from gnats) Date: Tue, 22 Jan 2002 08:00:06 -0800 (PST) Message-Id: <200201221600.g0MG06E22218@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Maxim Konovalov Subject: Re: kern/33771: bug in sendfile implementation if nbytes != 0 and struct sf_hdtr *hdtr->headers != NULL Reply-To: Maxim Konovalov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/33771; it has been noted by GNATS. From: Maxim Konovalov To: Vladislav Shabanov Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/33771: bug in sendfile implementation if nbytes != 0 and struct sf_hdtr *hdtr->headers != NULL Date: Tue, 22 Jan 2002 18:59:32 +0300 (MSK) Here is a patch: Index: uipc_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.65.2.9 diff -u -r1.65.2.9 uipc_syscalls.c --- uipc_syscalls.c 2001/07/31 10:49:39 1.65.2.9 +++ uipc_syscalls.c 2002/01/22 15:01:42 @@ -1532,10 +1532,11 @@ struct vm_page *pg; struct writev_args nuap; struct sf_hdtr hdtr; - off_t off, xfsize, sbytes = 0; + off_t off, xfsize, hdtr_size, sbytes = 0; int error = 0, s; vp = NULL; + hdtr_size = 0; /* * Do argument checking. Must be a regular file in, stream * type and connected socket out, positive offset. @@ -1591,7 +1592,7 @@ error = writev(p, &nuap); if (error) goto done; - sbytes += p->p_retval[0]; + hdtr_size += p->p_retval[0]; } } @@ -1831,11 +1832,12 @@ error = writev(p, &nuap); if (error) goto done; - sbytes += p->p_retval[0]; + hdtr_size += p->p_retval[0]; } done: if (uap->sbytes != NULL) { + sbytes += hdtr_size; copyout(&sbytes, uap->sbytes, sizeof(off_t)); } if (vp) -- Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message