fix(PICAN): align socket handling with PIEthernet patterns
- Sentinel: sock = 0 → sock = -1 (0 is stdin, valid fd) - openDevice(): close socket on ioctl/bind failure (resource leak) - openDevice(): set O_NONBLOCK via fcntl after socket() - openDevice(): check setsockopt() return value - closeDevice(): call shutdown() before close(), reset sock to -1 - readDevice() / writeDevice(): guard against sock == -1 - Add missing #include <fcntl.h>
This commit is contained in:
@@ -73,7 +73,7 @@ protected:
|
||||
|
||||
private:
|
||||
PRIVATE_DECLARATION(PIP_EXPORT)
|
||||
int sock;
|
||||
int sock = -1;
|
||||
int can_id, readed_id;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user