Changeset 3988 for trunk/libtransmission/inout.c
- Timestamp:
- Nov 26, 2007, 8:37:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/inout.c
r3918 r3988 28 28 #include "platform.h" 29 29 #include "peer-mgr.h" 30 #include "stats.h" 30 31 #include "utils.h" 31 32 … … 56 57 int fd = -1; 57 58 int ret; 59 int fileExists; 58 60 59 61 assert( 0<=fileIndex && fileIndex<info->fileCount ); … … 62 64 63 65 tr_buildPath ( path, sizeof(path), tor->destination, file->name, NULL ); 66 fileExists = !stat( path, &sb ); 64 67 65 68 if( !file->length ) 66 69 return 0; 67 else if ((ioMode==TR_IO_READ) && stat( path, &sb )) /* does file exist? */70 else if ((ioMode==TR_IO_READ) && !fileExists ) /* does file exist? */ 68 71 ret = tr_ioErrorFromErrno (); 69 72 else if ((fd = tr_fdFileCheckout ( path, ioMode==TR_IO_WRITE )) < 0) … … 75 78 else 76 79 ret = TR_OK; 80 81 if((ret==TR_OK) && (ioMode==TR_IO_WRITE) && !fileExists ) 82 tr_statsFileCreated( tor->handle ); 77 83 78 84 if( fd >= 0 )
Note: See TracChangeset
for help on using the changeset viewer.