From: Oliver Hartkopp Date: Mon, 26 Nov 2012 20:44:22 +0000 (+0100) Subject: slcanpty: fix wrong usage of nbytes variable X-Git-Url: https://rtime.felk.cvut.cz/gitweb/sojka/can-utils.git/commitdiff_plain/0fb5680a6151c04651472030fe78bae4de9e0114 slcanpty: fix wrong usage of nbytes variable nbytes is used after writing the CAN frame to check for an additional command in the string buffer. Therefore using nbytes while writing the CAN frame is wrong. Replace it with 'tmp' which can be used here without problems. Signed-off-by: ulrich escher Signed-off-by: Oliver Hartkopp --- diff --git a/slcanpty.c b/slcanpty.c index b45b1a8..67a7491 100644 --- a/slcanpty.c +++ b/slcanpty.c @@ -270,8 +270,8 @@ rx_restart: ptr--; } - nbytes = write(socket, &frame, sizeof(frame)); - if (nbytes != sizeof(frame)) { + tmp = write(socket, &frame, sizeof(frame)); + if (tmp != sizeof(frame)) { perror("write socket"); return 1; }