Pārlūkot izejas kodu

[image] Clear the command line rather than setting an empty command line

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 gadus atpakaļ
vecāks
revīzija
2dd23e1ee9
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. 6
    3
      src/hci/commands/image_cmd.c

+ 6
- 3
src/hci/commands/image_cmd.c Parādīt failu

@@ -45,13 +45,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
45 45
  */
46 46
 static int imgfill_cmdline ( struct image *image, unsigned int nargs, 
47 47
 			     char **args ) {
48
-	size_t len;
48
+	size_t len = 0;
49 49
 	unsigned int i;
50 50
 
51
+	/* Clear command line if no arguments given */
52
+	if ( ! nargs )
53
+		return image_set_cmdline ( image, NULL );
54
+
51 55
 	/* Determine total length of command line */
52
-	len = 1; /* NUL */
53 56
 	for ( i = 0 ; i < nargs ; i++ )
54
-		len += ( 1 /* possible space */ + strlen ( args[i] ) );
57
+		len += ( strlen ( args[i] ) + 1 /* space or NUL */ );
55 58
 
56 59
 	{
57 60
 		char buf[len];

Notiek ielāde…
Atcelt
Saglabāt