Changeset 8611
- Timestamp:
- Jun 4, 2009, 3:52:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/bencode.c
r8604 r8611 19 19 #include <string.h> 20 20 21 #include <sys/types.h> /* open() */22 #include <sys/stat.h> /* open() */23 #include <fcntl.h> /* open() */24 21 #include <locale.h> 25 22 #include <unistd.h> /* close() */ … … 38 35 #ifndef ENODATA 39 36 #define ENODATA EIO 40 #endif41 42 #ifndef O_BINARY43 #define O_BINARY 044 37 #endif 45 38 … … 1542 1535 { 1543 1536 int err = 0; 1544 int fd = open( filename, O_CREAT|O_WRONLY|O_TRUNC|O_BINARY);1545 1546 if( f d < 0)1537 FILE * fp = fopen( filename, "wb+" ); 1538 1539 if( fp == NULL ) 1547 1540 { 1548 1541 err = errno; … … 1557 1550 while( !err && EVBUFFER_LENGTH( buf ) ) 1558 1551 { 1559 if( evbuffer_write( buf, f d) == -1 )1552 if( evbuffer_write( buf, fileno(fp) ) == -1 ) 1560 1553 { 1561 1554 err = errno; … … 1568 1561 tr_dbg( "tr_bencToFile saved \"%s\"", filename ); 1569 1562 evbuffer_free( buf ); 1570 close( fd);1563 fclose( fp ); 1571 1564 } 1572 1565
Note: See TracChangeset
for help on using the changeset viewer.