[PATCH 1/4] hush: add getopt only if it enabled

Alexander Aring alex.aring at gmail.com
Thu Feb 7 15:36:17 EST 2013


This patch add getopt to the command list if it enabled via
Kconfig. With this patch we get a 'command not found' error.
Otherwise getopt doing nothing.

Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
 common/hush.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/hush.c b/common/hush.c
index 1f468f6..602f8f1 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -782,7 +782,8 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
 
 	remove_quotes(globbuf.gl_pathc, globbuf.gl_pathv);
 
-	if (!strcmp(globbuf.gl_pathv[0], "getopt")) {
+	if (!strcmp(globbuf.gl_pathv[0], "getopt") &&
+			IS_ENABLED(CONFIG_HUSH_GETOPT)) {
 		ret = builtin_getopt(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
 	} else if (!strcmp(globbuf.gl_pathv[0], "exit")) {
 		ret = builtin_exit(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
-- 
1.8.1.2




More information about the barebox mailing list