From bf549bbe0dc2f2b8ced41637279e2d3d8eeb0dbb Mon Sep 17 00:00:00 2001 From: Thomas Porzelt Date: Fri, 2 Jan 2009 22:04:36 +0100 Subject: [PATCH] add check for sizeof(off_t) to MODULE_VERSION_CHECK() --- include/lighttpd/module.h | 15 +++++++++++---- src/module.c | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/lighttpd/module.h b/include/lighttpd/module.h index eb284d5..1f198c5 100644 --- a/include/lighttpd/module.h +++ b/include/lighttpd/module.h @@ -5,10 +5,15 @@ #define MODULE_VERSION ((guint) 0x00000001) #define MODULE_VERSION_CHECK(mods) do { \ - if (mods->version != MODULE_VERSION) { \ - ERROR(mods->main, "Version mismatch for modules system: is %u, expected %u", mods->version, MODULE_VERSION); \ - return FALSE; \ - } } while(0) + if (mods->version != MODULE_VERSION) { \ + ERROR(mods->main, "Version mismatch for modules system: is %u, expected %u", mods->version, MODULE_VERSION); \ + return FALSE; \ + } \ + if (mods->sizeof_off_t != (guint8)sizeof(off_t)) { \ + ERROR(mods->main, "Compile flags mismatch: sizeof(off_t) is %u, expected %u", (guint) sizeof(off_t), mods->sizeof_off_t); \ + return FALSE; \ + } \ + } while(0) /** see module_load */ #define MODULE_DEPENDS(mods, name) do { \ @@ -43,6 +48,8 @@ struct modules { gpointer main; /**< pointer to a application specific main structure, e.g. server */ GArray *mods; /**< array of (module*) */ gchar *module_dir; + + guint8 sizeof_off_t; /** holds the value of sizeof(off_t) to check if loaded module was compiled with the same flags */ }; LI_API modules* modules_init(gpointer main, const gchar *module_dir); diff --git a/src/module.c b/src/module.c index 3d236bc..975437d 100644 --- a/src/module.c +++ b/src/module.c @@ -8,6 +8,7 @@ modules *modules_init(gpointer main, const gchar *module_dir) { m->main = main; m->mods = g_array_new(FALSE, TRUE, sizeof(module*)); m->module_dir = g_strdup(module_dir); + m->sizeof_off_t = sizeof(off_t); return m; }