Closed Bug 136251 Opened 18 years ago Closed 18 years ago

Incorrect assertion in pt_solaris_sendfile_cont

Categories

(NSPR :: NSPR, defect, P1)

Sun
Solaris
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file)

In ptio.c, function pt_solaris_sendfile_cont(), we have:

    count = SOLARIS_SENDFILEV(op->arg1.osfd, vec, op->arg3.amount, &xferred);
    PR_ASSERT((count == -1) || (count == xferred));
    PR_ASSERT(xferred <= op->nbytes_to_send);
    op->syserrno = errno;

The assertion "xferred <= op->nbytes_to_send" should not
be executed when sendfilev() fails with a real error.

Note: sendfilev() may fail with EAGAIN, EWOULDBLOCK, or
EINTR; these are not real errors and the value of 'xferred'
is valid.
Attached patch Proposed patchSplinter Review
I moved the assertion to a later place, after we have
handled the fatal errors.  I also changed 'xferred' to
'count' in the assertion because 'count' is what we
are using at that point.  (At that point, 'count' is
always equal to 'xferred'.)

I also save 'errno' in 'op->syserrno' right after the
sendfilev() call, just in case the assertion failures
may change the value of 'errno'.
Fix checked into the tip of NSPR.
Status: NEW → RESOLVED
Closed: 18 years ago
Priority: -- → P1
Resolution: --- → FIXED
Target Milestone: --- → 4.2.1
You need to log in before you can comment on or make changes to this bug.