Date: Sun, 14 Sep 2014 09:20:01 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271576 - projects/sendfile/sys/kern Message-ID: <201409140920.s8E9K163092377@svn.freebsd.org>
index | next in thread | raw e-mail
Author: glebius Date: Sun Sep 14 09:20:01 2014 New Revision: 271576 URL: http://svnweb.freebsd.org/changeset/base/271576 Log: Simplify hard error handling code. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: projects/sendfile/sys/kern/uipc_syscalls.c Modified: projects/sendfile/sys/kern/uipc_syscalls.c ============================================================================== --- projects/sendfile/sys/kern/uipc_syscalls.c Sun Sep 14 09:18:34 2014 (r271575) +++ projects/sendfile/sys/kern/uipc_syscalls.c Sun Sep 14 09:20:01 2014 (r271576) @@ -2932,7 +2932,7 @@ vn_sendfile(struct file *fp, int sockfd, struct shmfd *shmfd; struct vattr va; off_t off, sbytes, rem, obj_size; - int error, serror, bsize, hdrlen; + int error, bsize, hdrlen; obj = NULL; so = NULL; @@ -3211,29 +3211,24 @@ retry_space: CURVNET_SET(so->so_vnet); if (nios == 0) { free(sfio, M_TEMP); - serror = (*so->so_proto->pr_usrreqs->pru_send) + error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); } else { sfio->sock_fp = sock_fp; sfio->npages = npages; fhold(sock_fp); - serror = (*so->so_proto->pr_usrreqs->pru_send) + error = (*so->so_proto->pr_usrreqs->pru_send) (so, PRUS_NOTREADY, m, NULL, NULL, td); sf_io_done(sfio); } CURVNET_RESTORE(); - if (serror == 0) { - sbytes += space + hdrlen; - if (hdrlen) - hdrlen = 0; - } else if (error == 0) - error = serror; m = NULL; /* pru_send always consumes */ - - /* Quit outer loop on error. */ - if (error != 0) + if (error) goto done; + sbytes += space + hdrlen; + if (hdrlen) + hdrlen = 0; } /*help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409140920.s8E9K163092377>
