raiden00pl opened a new pull request, #17441: URL: https://github.com/apache/nuttx/pull/17441
## Summary drivers/can/can.c: fix broken O_NONBLOCK O_NONBLOCK open mode was broken since https://github.com/apache/nuttx/pull/17360 MIN() comapres signed value (int) with unsigned value (size_t) which causes an unexpected return value when ret is negative. ## Impact fix regression ## Testing simulator with CAN. a simple test showing that the previous code was wrong: ``` #include <stdio.h> int main() { #define MIN(a,b) (((a) < (b)) ? (a) : (b)) int x = -11; size_t y = 11; printf("x=%d y=%d min=%d min=%d\n", x, y, MIN(x,y), MIN(x,(int)y)); return 0; } ``` ``` x=-11 y=11 min=11 min=-11 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
