Opened 3 years ago

Closed 3 years ago

#1424 closed defect (wontfix)

Not consistent type cast in ngx_unix_send()

Reported by: Martijn81@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: ngx_unix_send, ngx_unix_recv Cc:
uname -a:
nginx -V: https://github.com/nginx/nginx/blob/master/src

Description

Maybe their is a reason for this, but below are 2 functions.
The check to determine if all data is send/received is inconsistent.
See below:

os/unix/ngx_recv.c:
124: if ((size_t) n < size) {
137: if ((size_t) n < size

os/unix/ngx_send.c:
40: if (n < (ssize_t) size) {

Variables n is ssize_t and size of size_t.

Change History (1)

comment:1 by Maxim Dounin, 3 years ago

Resolution: wontfix
Status: newclosed

There is no real difference. In all cases both n and size are expected fit into both size_t and ssize_t, it is up to the author of the particular code to choose how to write the condition.

Note: See TracTickets for help on using tickets.