]> rtime.felk.cvut.cz Git - sojka/can-utils.git/commitdiff
slcanpty: fix wrong usage of nbytes variable
authorOliver Hartkopp <socketcan@hartkopp.net>
Mon, 26 Nov 2012 20:44:22 +0000 (21:44 +0100)
committerOliver Hartkopp <socketcan@hartkopp.net>
Mon, 26 Nov 2012 20:44:22 +0000 (21:44 +0100)
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<git@myvdr.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
slcanpty.c

index b45b1a8d65ee196fad82f285d9e86a7e33189d84..67a7491390d06ee874f42a6e2e8fa07481faa5a4 100644 (file)
@@ -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;
        }