]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[image] Allow image_set_cmdline() to clear the command line
authorMichael Brown <mcb30@ipxe.org>
Mon, 7 Mar 2011 02:43:56 +0000 (02:43 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 7 Mar 2011 02:43:56 +0000 (02:43 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/image.c

index cb9615311eeb2eebc97fc8905730e4c18497e13b..6caa0243480097cef1de2baf56e1fe8d586d3083 100644 (file)
@@ -95,14 +95,18 @@ void image_set_uri ( struct image *image, struct uri *uri ) {
  * Set image command line
  *
  * @v image            Image
- * @v cmdline          New image command line
+ * @v cmdline          New image command line, or NULL
  * @ret rc             Return status code
  */
 int image_set_cmdline ( struct image *image, const char *cmdline ) {
+
        free ( image->cmdline );
-       image->cmdline = strdup ( cmdline );
-       if ( ! image->cmdline )
-               return -ENOMEM;
+       image->cmdline = NULL;
+       if ( cmdline ) {
+               image->cmdline = strdup ( cmdline );
+               if ( ! image->cmdline )
+                       return -ENOMEM;
+       }
        return 0;
 }