Browse Source

[image] Allow image_set_cmdline() to clear the command line

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
659c55c1a9
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      src/core/image.c

+ 8
- 4
src/core/image.c View File

@@ -95,14 +95,18 @@ void image_set_uri ( struct image *image, struct uri *uri ) {
95 95
  * Set image command line
96 96
  *
97 97
  * @v image		Image
98
- * @v cmdline		New image command line
98
+ * @v cmdline		New image command line, or NULL
99 99
  * @ret rc		Return status code
100 100
  */
101 101
 int image_set_cmdline ( struct image *image, const char *cmdline ) {
102
+
102 103
 	free ( image->cmdline );
103
-	image->cmdline = strdup ( cmdline );
104
-	if ( ! image->cmdline )
105
-		return -ENOMEM;
104
+	image->cmdline = NULL;
105
+	if ( cmdline ) {
106
+		image->cmdline = strdup ( cmdline );
107
+		if ( ! image->cmdline )
108
+			return -ENOMEM;
109
+	}
106 110
 	return 0;
107 111
 }
108 112
 

Loading…
Cancel
Save