Thread (3 messages) 3 messages, 3 authors, 2014-01-16

[PATCH] slcanpty: declare command buffer static

From: <hidden>
Date: 2014-01-13 13:29:42
Subsystem: the rest · Maintainer: Linus Torvalds

From: Yegor Yefremov <redacted>

ASCII command buffer char buf[200] must be declared as static,
because it holds incomplete commands between pty2can() calls.
Without static it is not guaranteed, that buf retains the same
data between calls.

Signed-off-by: Yegor Yefremov <redacted>
---
 slcanpty.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/slcanpty.c b/slcanpty.c
index 2c1cabe..c062a02 100644
--- a/slcanpty.c
+++ b/slcanpty.c
@@ -68,7 +68,7 @@ int pty2can(int pty, int socket, struct can_filter *fi,
 {
 	int nbytes;
 	char cmd;
-	char buf[200];
+	static char buf[200];
 	char replybuf[10]; /* for answers to received commands */
 	int ptr;
 	struct can_frame frame;
-- 
1.7.7
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help