Changeset 2253


Ignore:
Timestamp:
Aug 28, 2008 11:11:28 AM (11 years ago)
Author:
bennylp
Message:

Ticket #604: Error opening file in append mode in Win32 (thanks Gang Liu for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/file_io_win32.c

    r2039 r2253  
    6060        if ((flags & PJ_O_APPEND) == PJ_O_APPEND) { 
    6161            dwDesiredAccess |= FILE_APPEND_DATA; 
     62            dwCreationDisposition |= OPEN_EXISTING; 
    6263        } else { 
    6364            dwDesiredAccess &= ~(FILE_APPEND_DATA); 
     
    8586        *fd = 0; 
    8687        return PJ_RETURN_OS_ERROR(GetLastError()); 
     88    } 
     89 
     90    if ((flags & PJ_O_APPEND) == PJ_O_APPEND) { 
     91        pj_status_t status; 
     92 
     93        status = pj_file_setpos(hFile, 0, PJ_SEEK_END); 
     94        if (status != PJ_SUCCESS) { 
     95            pj_file_close(hFile); 
     96            return status; 
     97        } 
    8798    } 
    8899 
Note: See TracChangeset for help on using the changeset viewer.