diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.bin/rcp.c | 9 | ||||
-rw-r--r-- | usr/src/lib/libsendfile/common/sendfile.c | 44 |
2 files changed, 39 insertions, 14 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/rcp.c b/usr/src/cmd/cmd-inet/usr.bin/rcp.c index 057a0c7f1c..f91ffc6d27 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/rcp.c +++ b/usr/src/cmd/cmd-inet/usr.bin/rcp.c @@ -1197,8 +1197,13 @@ notreg: while (size != 0) { amt = MIN(size, SENDFILE_SIZE); cnt = sendfile(rem, f, &off, amt); - if (cnt == -1) - break; + if (cnt == -1) { + if (errno == EINTR) { + continue; + } else { + break; + } + } size -= cnt; } if (cnt == -1) { 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 |