[PATCH]: lash: Bug fix. Avoid trying to open a NULL path.

Shaun Jackman sjackman at gmail.com
Fri Jul 7 22:03:56 UTC 2006


If lash starts up in non-interactive mode, it refuses to read its
input from standard input. Instead it will attempt to open
argv[optind], which may be NULL.

Cheers,
Shaun

2006-07-07  Shaun Jackman  <sjackman at gmail.com>

	* shell/lash.c (lash_main): Bug fix. Avoid trying to open a NULL
	path.

--- shell/lash.c	77d0a727eb06192ad0dfdbd830c349ed0979f5ff
+++ shell/lash.c	611e50bbcf9647bfe9bd63d5bc4e86fd03317a21
@@ -1604,7 +1604,7 @@
  		printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER);
  		printf( "Enter 'help' for a list of built-in commands.\n\n");
  #endif
-	} else if (local_pending_command==NULL) {
+	} else if (local_pending_command==NULL && argv[optind] != NULL) {
  		//printf( "optind=%d  argv[optind]='%s'\n", optind, argv[optind]);
  		input = bb_xfopen(argv[optind], "r");
 		/* be lazy, never mark this closed */
-------------- next part --------------
2006-07-07  Shaun Jackman  <sjackman at gmail.com>

	* shell/lash.c (lash_main): Bug fix. Avoid trying to open a NULL
	path.

--- shell/lash.c	77d0a727eb06192ad0dfdbd830c349ed0979f5ff
+++ shell/lash.c	611e50bbcf9647bfe9bd63d5bc4e86fd03317a21
@@ -1604,7 +1604,7 @@
 		printf( "\n\n%s Built-in shell (lash)\n", BB_BANNER);
 		printf( "Enter 'help' for a list of built-in commands.\n\n");
 #endif
-	} else if (local_pending_command==NULL) {
+	} else if (local_pending_command==NULL && argv[optind] != NULL) {
 		//printf( "optind=%d  argv[optind]='%s'\n", optind, argv[optind]);
 		input = bb_xfopen(argv[optind], "r");
 		/* be lazy, never mark this closed */


More information about the busybox mailing list