VirtualBox

Changeset 82837 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jan 23, 2020 1:35:04 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135806
Message:

IPRT/file: Added some more thoughts and @todo regarding the RTFILE_O_APPEND situation. Updated flag docs. ticketref:19003

Location:
trunk/src/VBox/Runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/fileio-win.cpp

    r82836 r82837  
    935935
    936936    /*
    937      * Change the EOF marker.  We may have to
     937     * Change the EOF marker.
     938     *
     939     * HACK ALERT! If the file was opened in RTFILE_O_APPEND mode, we will have
     940     *             to re-open it with FILE_WRITE_DATA access to get the job done.
     941     *             This how ftruncate on a unixy system would work but not how
     942     *             it is done on Windows where appending is a separate permission
     943     *             rather than just a write modifier, making this hack totally wrong.
     944     */
     945    /** @todo The right way to fix this is either to add a RTFileSetSizeEx function
     946     *        for specifically requesting the unixy behaviour, or add an additional
     947     *        flag to RTFileOpen[Ex] to request the unixy append behaviour there.
     948     *        The latter would require saving the open flags in a instance data
     949     *        structure, which is a bit of a risky move, though something we should
     950     *        do in 6.2 (or later).
     951     *
     952     *        Note! Because handle interitance, it is not realyan option to
     953     *              always use FILE_WRITE_DATA and implement the RTFILE_O_APPEND
     954     *              bits in RTFileWrite and friends.  Besides, it's not like
     955     *              RTFILE_O_APPEND is so clearly defined anyway - see
     956     *              RTFileWriteAt.
    938957     */
    939958    IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
  • trunk/src/VBox/Runtime/testcase/tstFile.cpp

    r82836 r82837  
    7878#if 1 //ndef RT_OS_WINDOWS
    7979    /*
    80      * Truncate the file and write some more. This is problematic on windows.
     80     * Truncate the file and write some more. This is problematic on windows,
     81     * we currently have a questionable hack in place to make this work.
    8182     */
    8283    RTTESTI_CHECK_RC_RETV(RTFileSetSize(hFile, 0), VINF_SUCCESS);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette