VirtualBox

Changeset 60424 in vbox


Ignore:
Timestamp:
Apr 11, 2016 12:55:57 PM (8 years ago)
Author:
vboxsync
Message:

Runtime/linux/sysfs: RTLinuxSysFsReadStr() has to be return VERR_BUFFER_OVERFLOW like RTLinuxSysFsReadFile()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/sysfs.cpp

    r60393 r60424  
    234234        && pcchRead)
    235235        *pcchRead = cchRead;
    236 
     236    if (RT_SUCCESS(rc))
     237    {
     238        /* Check for EOF */
     239        uint64_t offCur = 0;
     240        uint64_t offEnd = 0;
     241        rc = RTFileSeek(hFile, 0, RTFILE_SEEK_CURRENT, &offCur);
     242        if (RT_SUCCESS(rc))
     243            rc = RTFileSeek(hFile, 0, RTFILE_SEEK_END, &offEnd);
     244        if (   RT_SUCCESS(rc)
     245            && offEnd > offCur)
     246            rc = VERR_BUFFER_OVERFLOW;
     247    }
    237248    return rc;
    238249}
     
    262273        {
    263274            /* Check for EOF */
    264             char     ch;
    265275            uint64_t offCur = 0;
    266276            uint64_t offEnd = 0;
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