VirtualBox

Ignore:
Timestamp:
Feb 25, 2010 11:56:52 AM (15 years ago)
Author:
vboxsync
Message:

iprt/pipe.h++: Adjusted RTPipeWrite[Blocking] behavior wrt to zero byte writes and broken pipes. (darwin will return EPIPE, linux does not.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTPipe.cpp

    r26775 r26784  
    140140    RTTESTI_CHECK_RC_RETV(RTPipeCreate(&hPipeR, &hPipeW, RTPIPE_C_INHERIT_READ | RTPIPE_C_INHERIT_WRITE), VINF_SUCCESS);
    141141    int rc = RTPipeFlush(hPipeW);
    142     RTTESTI_CHECK(rc == VERR_NOT_SUPPORTED || rc == VINF_SUCCESS);
     142    RTTESTI_CHECK_MSG(rc == VERR_NOT_SUPPORTED || rc == VINF_SUCCESS, ("%Rrc\n", rc));
    143143    RTTESTI_CHECK_RC_RETV(RTPipeClose(hPipeR), VINF_SUCCESS);
    144144    RTTESTI_CHECK_RC_RETV(RTPipeClose(hPipeW), VINF_SUCCESS);
     
    223223    RTTESTI_CHECK_RC_RETV(RTPipeClose(hPipeR), VINF_SUCCESS);
    224224    cbWritten = ~(size_t)2;
    225     RTTESTI_CHECK_RC(RTPipeWrite(hPipeW, "", 0, &cbWritten), VERR_BROKEN_PIPE);
    226     RTTESTI_CHECK(cbWritten == ~(size_t)2);
     225    RTTESTI_CHECK_RC(RTPipeWrite(hPipeW, "", 0, &cbWritten), VINF_SUCCESS);
     226    RTTESTI_CHECK(cbWritten == 0);
    227227    cbWritten = ~(size_t)2;
    228228    RTTESTI_CHECK_RC(RTPipeWrite(hPipeW, "4", 1, &cbWritten), VERR_BROKEN_PIPE);
     
    233233    RTTESTI_CHECK_RC_RETV(RTPipeClose(hPipeW), VINF_SUCCESS);
    234234    cbRead = ~(size_t)0;
    235     RTTESTI_CHECK_RC(RTPipeRead(hPipeR, abBuf, 0, &cbRead), VINF_SUCCESS);         // !?
     235    RTTESTI_CHECK_RC(RTPipeRead(hPipeR, abBuf, 0, &cbRead), VINF_SUCCESS);
    236236    RTTESTI_CHECK(cbRead == 0);
    237237    cbRead = ~(size_t)3;
     
    284284    RTTESTI_CHECK(!memcmp(abBuf, "42!", 3));
    285285    RTTESTI_CHECK_RC(RTPipeClose(hPipeR), VINF_SUCCESS);
    286     RTTESTI_CHECK_RC_RETV(RTPipeWriteBlocking(hPipeW, "", 0), VERR_BROKEN_PIPE);
     286    RTTESTI_CHECK_RC_RETV(RTPipeWriteBlocking(hPipeW, "", 0), VINF_SUCCESS);
    287287    RTTESTI_CHECK_RC_RETV(RTPipeWriteBlocking(hPipeW, "42", 2), VERR_BROKEN_PIPE);
    288288    RTTESTI_CHECK_RC(RTPipeClose(hPipeW), 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