summaryrefslogtreecommitdiffstats
path: root/src/core/exec.c
diff options
context:
space:
mode:
authorMichael Brown2011-04-01 21:07:17 +0200
committerMichael Brown2011-04-01 21:09:51 +0200
commit06f1878fb8ccb35e3b07569ecd1c2ead3a4bfbcf (patch)
treec95d3b2749bffcb2399c656964eb8394bfa1a76d /src/core/exec.c
parent[tftp] Avoid setting current working URI to "tftp://0.0.0.0/" (diff)
downloadipxe-06f1878fb8ccb35e3b07569ecd1c2ead3a4bfbcf.tar.gz
ipxe-06f1878fb8ccb35e3b07569ecd1c2ead3a4bfbcf.tar.xz
ipxe-06f1878fb8ccb35e3b07569ecd1c2ead3a4bfbcf.zip
[cmdline] Fix "isset" command
Commit b5f5f73 ("[cmdline] Expand settings within each command-line token individually") introduced a regression into the "isset" command: it is now possible for command-line arguments to be empty strings, and so "isset" cannot simply check for a non-empty argument list. Restore previous behaviour by checking for the presence of any non-empty arguments, rather than checking for a non-empty argument list. Reported-by: Nemtallah Daher <n.daher@csuohio.edu> Tested-by: Nemtallah Daher <n.daher@csuohio.edu> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/exec.c')
-rw-r--r--src/core/exec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/exec.c b/src/core/exec.c
index 8da28827..008083bc 100644
--- a/src/core/exec.c
+++ b/src/core/exec.c
@@ -476,14 +476,20 @@ static struct command_descriptor isset_cmd =
*/
static int isset_exec ( int argc, char **argv ) {
struct isset_options opts;
+ int i;
int rc;
/* Parse options */
if ( ( rc = parse_options ( argc, argv, &isset_cmd, &opts ) ) != 0 )
return rc;
- /* Return success iff any arguments exist */
- return ( ( optind == argc ) ? -ENOENT : 0 );
+ /* Return success if any argument is non-empty */
+ for ( i = optind ; i < argc ; i++ ) {
+ if ( argv[i][0] != '\0' )
+ return 0;
+ }
+
+ return -ENOENT;
}
/** "isset" command */