Module Name: src
Committed By: mbalmer
Date: Sat May 20 08:31:13 UTC 2017
Modified Files:
src/sys/modules/lua: lua.c
Log Message:
Only load a module if it is not already loaded in a state (much like userland
Lua handles require).
Fixes PR kern/52226.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/modules/lua/lua.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.21 src/sys/modules/lua/lua.c:1.22
--- src/sys/modules/lua/lua.c:1.21 Thu May 11 07:34:27 2017
+++ src/sys/modules/lua/lua.c Sat May 20 08:31:13 2017
@@ -1,8 +1,8 @@
-/* $NetBSD: lua.c,v 1.21 2017/05/11 07:34:27 mbalmer Exp $ */
+/* $NetBSD: lua.c,v 1.22 2017/05/20 08:31:13 mbalmer Exp $ */
/*
+ * Copyright (c) 2011 - 2017 by Marc Balmer <[email protected]>.
* Copyright (c) 2014 by Lourival Vieira Neto <[email protected]>.
- * Copyright (c) 2011 - 2014 by Marc Balmer <[email protected]>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -514,6 +514,10 @@ lua_require(lua_State *L)
if (md != NULL)
LIST_FOREACH(s, &lua_states, lua_next)
if (s->K->L == L) {
+ LIST_FOREACH(m, &s->lua_modules, mod_next)
+ if (m == md)
+ return 1;
+
if (lua_verbose)
device_printf(sc_self,
"require module %s\n",