From 3a76162c322729faf0caf60956706166d90f1185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Mon, 17 Feb 2014 12:49:57 +0100 Subject: [PATCH] - avoid double registrations for same architecure --- initvm.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/initvm.c b/initvm.c index 517d5016f..55686ea51 100644 --- a/initvm.c +++ b/initvm.c @@ -20,6 +20,7 @@ * * AUTHOR * James Perkins + * Adrian Schroeter */ #include @@ -210,7 +211,24 @@ enum okfail binfmt_register(char *datafile, char *regfile) continue; } - int ret=access(f[interpreter], X_OK); + int ret; + /* Is an interpreter for this arch already registered? */ + snprintf(path, sizeof(path), SYSFS_BINFMT_MISC "/%s", f[name]); + ret=access(path, X_OK); + fprintf(stderr, + "interpreter for '%s' is %d\n", + f[name], ret); + if (ret == 0) { +#ifdef DEBUG + fprintf(stderr, + "interpreter for '%s' already registered, ignoring\n", + f[name]); +#endif /* DEBUG */ + continue; + } + + /* Does the interpreter exists? */ + ret=access(f[interpreter], X_OK); if (ret != 0) { #ifdef DEBUG fprintf(stderr,