diff options
author | kjnash <k.j.nash@usa.net> | 2022-08-31 15:24:20 (GMT) |
---|---|---|
committer | kjnash <k.j.nash@usa.net> | 2022-08-31 15:24:20 (GMT) |
commit | 7443a97bd1d5060c2bc3ea57dbd1899ea2efb9b8 (patch) | |
tree | a7402019faf3e75458552fe9dde90324f981fe7b /unix/tclUnixChan.c | |
parent | 19f8c3bb6b2aa8d571a7534b588ddacfb49952d3 (diff) | |
parent | 52b58d0c7d1575d7c784ccb344862e0de8a9686b (diff) | |
download | tcl-7443a97bd1d5060c2bc3ea57dbd1899ea2efb9b8.zip tcl-7443a97bd1d5060c2bc3ea57dbd1899ea2efb9b8.tar.gz tcl-7443a97bd1d5060c2bc3ea57dbd1899ea2efb9b8.tar.bz2 |
Merge old 8.7 6c69a72c58
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 9273b8e..4cb9af0 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -4,8 +4,8 @@ * Common channel driver for Unix channels based on files, command pipes * and TCP sockets. * - * Copyright (c) 1995-1997 Sun Microsystems, Inc. - * Copyright (c) 1998-1999 by Scriptics Corporation. + * Copyright © 1995-1997 Sun Microsystems, Inc. + * Copyright © 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -133,9 +133,9 @@ static int FileSeekProc(void *instanceData, long offset, int mode, int *errorCode); #endif static int FileTruncateProc(void *instanceData, - Tcl_WideInt length); -static Tcl_WideInt FileWideSeekProc(void *instanceData, - Tcl_WideInt offset, int mode, int *errorCode); + long long length); +static long long FileWideSeekProc(void *instanceData, + long long offset, int mode, int *errorCode); static void FileWatchProc(void *instanceData, int mask); #ifdef SUPPORTS_TTY static int TtyCloseProc(void *instanceData, @@ -282,12 +282,15 @@ FileInputProc( * nonblocking, the read will never block. */ - bytesRead = read(fsPtr->fd, buf, (size_t) toRead); - if (bytesRead >= 0) { - return bytesRead; + do { + bytesRead = read(fsPtr->fd, buf, (size_t) toRead); + } while ((bytesRead < 0) && (errno == EINTR)); + + if (bytesRead < 0) { + *errorCodePtr = errno; + return -1; } - *errorCodePtr = errno; - return -1; + return bytesRead; } /* @@ -456,7 +459,7 @@ FileSeekProc( int *errorCodePtr) /* To store error code. */ { FileState *fsPtr = (FileState *)instanceData; - Tcl_WideInt oldLoc, newLoc; + long long oldLoc, newLoc; /* * Save our current place in case we need to roll-back the seek. @@ -509,16 +512,16 @@ FileSeekProc( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static long long FileWideSeekProc( void *instanceData, /* File state. */ - Tcl_WideInt offset, /* Offset to seek to. */ + long long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_CUR or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { FileState *fsPtr = (FileState *)instanceData; - Tcl_WideInt newLoc; + long long newLoc; newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode); @@ -2037,7 +2040,7 @@ Tcl_GetOpenFile( static int FileTruncateProc( void *instanceData, - Tcl_WideInt length) + long long length) { FileState *fsPtr = (FileState *)instanceData; int result; |