linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slcanpty: declare command buffer static
@ 2014-01-13 13:29 yegorslists
  2014-01-13 17:56 ` Oliver Hartkopp
  2014-01-16 16:18 ` Marc Kleine-Budde
  0 siblings, 2 replies; 3+ messages in thread
From: yegorslists @ 2014-01-13 13:29 UTC (permalink / raw)
  To: linux-can; +Cc: socketcan, mkl, Yegor Yefremov

From: Yegor Yefremov <yegorslists@googlemail.com>

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 <yegorslists@googlemail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-16 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 13:29 [PATCH] slcanpty: declare command buffer static yegorslists
2014-01-13 17:56 ` Oliver Hartkopp
2014-01-16 16:18 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).