From: Johannes Berg Date: Sun, 5 Jul 2009 12:37:40 +0000 (+0200) Subject: check event size for version 1 X-Git-Tag: v2.31-rc1~98^2~13^2~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e4e0b50005c68cd15dba0300c3fdf65503750fd;p=thirdparty%2Futil-linux.git check event size for version 1 If we ever increase the event struct size, then we will need to handle multiple event sizes, so let's define the current event size and check for that so we remember to fix it up when (if ever) we need to change things. --- diff --git a/core.h b/core.h index c276b90c57..d1886dfb35 100644 --- a/core.h +++ b/core.h @@ -1,6 +1,16 @@ #ifndef __CORE #define __CORE +#include "rfkill.h" + extern const char rfkill_version[]; +/* + * first version of event size, + * members idx, type, op, soft, hard + */ +#ifndef RFKILL_EVENT_SIZE_V1 +#define RFKILL_EVENT_SIZE_V1 8 +#endif + #endif diff --git a/rfkill.c b/rfkill.c index 6b29144b14..4d4b6b97f7 100644 --- a/rfkill.c +++ b/rfkill.c @@ -49,7 +49,7 @@ static void rfkill_event(void) break; } - if (len != sizeof(event)) { + if (len != RFKILL_EVENT_SIZE_V1) { fprintf(stderr, "Wrong size of RFKILL event\n"); continue; } @@ -137,7 +137,7 @@ static void rfkill_list(void) break; } - if (len != sizeof(event)) { + if (len != RFKILL_EVENT_SIZE_V1) { fprintf(stderr, "Wrong size of RFKILL event\n"); continue; }