From a3a8c0e1799b231762a5b1def31f200a5a036e2c Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Fri, 19 Mar 2010 13:18:53 +0000 Subject: [PATCH] Safety check: only try to read a packet if it was preceeded by an interrupt (which sets the pending flag) --- core/dev/cc2420.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/dev/cc2420.c b/core/dev/cc2420.c index 2d3d30fcf..d85bb7f2e 100644 --- a/core/dev/cc2420.c +++ b/core/dev/cc2420.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: cc2420.c,v 1.45 2010/03/16 18:10:09 adamdunkels Exp $ + * @(#)$Id: cc2420.c,v 1.46 2010/03/19 13:18:53 adamdunkels Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -631,6 +631,10 @@ cc2420_read(void *buf, unsigned short bufsize) uint16_t checksum; #endif /* CC2420_CONF_CHECKSUM */ + if(!pending) { + return 0; + } + pending = 0; GET_LOCK();