Skip to content

Commit

Permalink
- avoid double registrations for same architecure
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Feb 17, 2014
1 parent 2c6ec1f commit 3a76162
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion initvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* AUTHOR
* James Perkins <[email protected]>
* Adrian Schroeter <[email protected]>
*/

#include <sys/mount.h>
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3a76162

Please sign in to comment.