summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown2011-03-07 03:44:24 +0100
committerMichael Brown2011-03-07 03:44:24 +0100
commit2dd23e1ee9b5d0c7a233e9f8e3dba3eef9b793bc (patch)
tree78965b5300e2b81f2fb1df7c6cb62ea113ca6464 /src/hci
parent[image] Allow image_set_cmdline() to clear the command line (diff)
downloadipxe-2dd23e1ee9b5d0c7a233e9f8e3dba3eef9b793bc.tar.gz
ipxe-2dd23e1ee9b5d0c7a233e9f8e3dba3eef9b793bc.tar.xz
ipxe-2dd23e1ee9b5d0c7a233e9f8e3dba3eef9b793bc.zip
[image] Clear the command line rather than setting an empty command line
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/commands/image_cmd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/hci/commands/image_cmd.c b/src/hci/commands/image_cmd.c
index 9b3895a9f..7001087b6 100644
--- a/src/hci/commands/image_cmd.c
+++ b/src/hci/commands/image_cmd.c
@@ -45,13 +45,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
static int imgfill_cmdline ( struct image *image, unsigned int nargs,
char **args ) {
- size_t len;
+ size_t len = 0;
unsigned int i;
+ /* Clear command line if no arguments given */
+ if ( ! nargs )
+ return image_set_cmdline ( image, NULL );
+
/* Determine total length of command line */
- len = 1; /* NUL */
for ( i = 0 ; i < nargs ; i++ )
- len += ( 1 /* possible space */ + strlen ( args[i] ) );
+ len += ( strlen ( args[i] ) + 1 /* space or NUL */ );
{
char buf[len];