Skip to contentSkip to conversation

slcanpty.c Remove one Bug

PATCH In review Ulrich Escher 2 participants 2 messages Nov 26, 2012 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slcanpty.c Remove one Bug

It is an error to overwrite nbytes at this point.
LG Ulrich

---
 slcanpty.c |    4 +++-----
 1 file changed, 2 insertions(+), 2 deletions(-)
slcanpty.c +2 -2
index e3b7304..3c1935a 100644
@@ -281,8 +279,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;
        }
#1 lore raw
Quoted 2 lines · Ulrich Escher

It is an error to overwrite nbytes at this point.
LG Ulrich

Can you make the patch description a bit more verbose. With this patch alone it's impossible to see what's the nbytes is used for and what is the bug here.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |