hubo / hubo-ach

Low level controller for the Hubo 2 and Hubo 2+ platforms designed by Daniel M. Lofaro. The system is based on the IPC called ACH by Neil Dantam and Mike Stilman.
Other
5 stars 18 forks source link

readn() has undefined behavior #58

Closed ndantam closed 11 years ago

ndantam commented 11 years ago

File descriptor is treated as count; this will produce undefined behavior.

I'm actually not even sure what this function is supposed to do. Should it read one CAN frame with a timeout? If so, I don't think there is any need to repeatedly select() as the kernel cannot receive a partial CAN frame, so you won't block on read() with half the message.

I think poll() is a little nicer than select(), but they both do the same thing (poll() is from BSD, select() is from SysV).

ndantam commented 11 years ago

I need to read man pages more carefully.