Added copyright header
transmit() returns error code on error
Using MAX_PACKET_SIZE where appropriate
fail if ioctl fails
Reordered variables
Added error handling for malloc
Uncrustified source