mirror of https://github.com/ipxe/ipxe.git
[image] Clear the command line rather than setting an empty command line
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
659c55c1a9
commit
2dd23e1ee9
|
@ -45,13 +45,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
*/
|
*/
|
||||||
static int imgfill_cmdline ( struct image *image, unsigned int nargs,
|
static int imgfill_cmdline ( struct image *image, unsigned int nargs,
|
||||||
char **args ) {
|
char **args ) {
|
||||||
size_t len;
|
size_t len = 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Clear command line if no arguments given */
|
||||||
|
if ( ! nargs )
|
||||||
|
return image_set_cmdline ( image, NULL );
|
||||||
|
|
||||||
/* Determine total length of command line */
|
/* Determine total length of command line */
|
||||||
len = 1; /* NUL */
|
|
||||||
for ( i = 0 ; i < nargs ; i++ )
|
for ( i = 0 ; i < nargs ; i++ )
|
||||||
len += ( 1 /* possible space */ + strlen ( args[i] ) );
|
len += ( strlen ( args[i] ) + 1 /* space or NUL */ );
|
||||||
|
|
||||||
{
|
{
|
||||||
char buf[len];
|
char buf[len];
|
||||||
|
|
Loading…
Reference in New Issue