From 096628fb1d128c98f088e96ce6397ecf3cb956ab Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Wed, 8 May 2013 00:45:46 -0700 Subject: [PATCH] Make sh use execvp directly --- userspace/core/sh.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/userspace/core/sh.c b/userspace/core/sh.c index b93d52c4..a35f1b46 100644 --- a/userspace/core/sh.c +++ b/userspace/core/sh.c @@ -868,26 +868,6 @@ _done: if (func) { return func(tokenid, argv); } else { - FILE * file = NULL; //fopen(argv[0], "r"); - if (!strstr(argv[0],"/")) { - cmd = malloc(sizeof(char) * (strlen(argv[0]) + strlen("/bin/") + 1)); - sprintf(cmd, "%s%s", "/bin/", argv[0]); - file = fopen(cmd,"r"); - if (!file) { - fprintf(stderr, "%s: Command not found\n", argv[0]); - free(cmd); - return 1; - } - fclose(file); - } else { - file = fopen(argv[0], "r"); - if (!file) { - fprintf(stderr, "%s: Command not found\n", argv[0]); - free(cmd); - return 1; - } - fclose(file); - } int nowait = (!strcmp(argv[tokenid-1],"&")); if (nowait) {