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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/1/head
Michael Brown 2011-03-07 02:43:56 +00:00
parent d1ad046a87
commit 659c55c1a9
1 changed files with 8 additions and 4 deletions

View File

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