diff options
author | Adrian Schröter <adrian@suse.de> | 2014-02-17 12:49:57 +0100 |
---|---|---|
committer | Adrian Schröter <adrian@suse.de> | 2014-02-17 13:16:50 +0100 |
commit | 3a76162c322729faf0caf60956706166d90f1185 (patch) | |
tree | a0677fe4d9e91d9b3ba83a466dd69e28c8b08921 | |
parent | 2c6ec1fa5f0dca5791ae02190a59ff71b431027f (diff) |
- avoid double registrations for same architecure
-rw-r--r-- | initvm.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -20,6 +20,7 @@ * * AUTHOR * James Perkins <james.perkins@linuxfoundation.org> + * Adrian Schroeter <adrian@suse.de> */ #include <sys/mount.h> @@ -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, |