diff options
Diffstat (limited to 'usr/src/lib/libsendfile/common/sendfile.c')
-rw-r--r-- | usr/src/lib/libsendfile/common/sendfile.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/usr/src/lib/libsendfile/common/sendfile.c b/usr/src/lib/libsendfile/common/sendfile.c index b7ed7fdca5..f4f7724843 100644 --- a/usr/src/lib/libsendfile/common/sendfile.c +++ b/usr/src/lib/libsendfile/common/sendfile.c @@ -1,10 +1,10 @@ + /* * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +20,7 @@ * CDDL HEADER END */ /* - * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,8 +49,13 @@ _sendfilev(int sock, const struct sendfilevec *vec, int sfvcnt, size_t *xferred) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV, sock, vec, sfvcnt, xferred); - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && *xferred != 0) { + rval.sys_rval1 = *xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -69,8 +74,13 @@ _sendfile(int sock, int fd, off_t *off, size_t len) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV, sock, &sfv, 1, &xferred); *off += xferred; - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && xferred != 0) { + rval.sys_rval1 = xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -88,8 +98,13 @@ _sendfilev64(int sock, const struct sendfilevec64 *vec, int sfvcnt, error = __systemcall(&rval, SYS_sendfilev, SENDFILEV64, sock, vec, sfvcnt, xferred); - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && *xferred != 0) { + rval.sys_rval1 = *xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } @@ -108,8 +123,13 @@ _sendfile64(int sock, int fd, off64_t *off, size_t len) error = __systemcall(&rval, SYS_sendfilev, SENDFILEV64, sock, &sfv, 1, &xferred); *off += xferred; - if (error != 0) - (void) __set_errno(error); + if (error != 0) { + if (error == EINTR && xferred != 0) { + rval.sys_rval1 = xferred; + } else { + (void) __set_errno(error); + } + } return ((ssize_t)rval.sys_rval1); } #endif |