Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/modules/lua fix double require bug



details:   https://anonhg.NetBSD.org/src/rev/7b825b020ba0
branches:  trunk
changeset: 345350:7b825b020ba0
user:      salazar <salazar%NetBSD.org@localhost>
date:      Sat May 21 12:39:32 2016 +0000

description:
fix double require bug

diffstat:

 sys/modules/lua/lua.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r feb36b35faf6 -r 7b825b020ba0 sys/modules/lua/lua.c
--- a/sys/modules/lua/lua.c     Sat May 21 07:22:28 2016 +0000
+++ b/sys/modules/lua/lua.c     Sat May 21 12:39:32 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lua.c,v 1.16 2015/02/07 04:09:13 christos Exp $ */
+/*     $NetBSD: lua.c,v 1.17 2016/05/21 12:39:32 salazar Exp $ */
 
 /*
  * Copyright (c) 2014 by Lourival Vieira Neto <lneto%NetBSD.org@localhost>.
@@ -355,7 +355,10 @@
        case LUAREQUIRE:        /* 'require' a module in a State */
                require = data;
                LIST_FOREACH(s, &lua_states, lua_next)
-                       if (!strcmp(s->lua_name, require->state))
+                       if (!strcmp(s->lua_name, require->state)) {
+                               LIST_FOREACH(m, &s->lua_modules, mod_next)
+                                       if (!strcmp(m->mod_name, require->module))
+                                               return ENXIO;
                                LIST_FOREACH(m, &lua_modules, mod_next)
                                        if (!strcmp(m->mod_name,
                                            require->module)) {
@@ -379,6 +382,7 @@
                                                    mod_next);
                                                return 0;
                                        }
+                       }
                return ENXIO;
        case LUALOAD:
                load = data;



Home | Main Index | Thread Index | Old Index