WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxl: compile fix

On Wed, 2010-07-28 at 12:42 +0100, Christoph Egger wrote:
> Hi!
> 
> Attached patch fixes this compile error:
> 
> xl_cmdimpl.c: In function 'create_domain':
> xl_cmdimpl.c:1099: warning: 'action' may be used uninitialized in this 
> function

Thanks.

This can't actually happen in practice today since the switch statement
covers all of the possible values of info->shutdown_reason. (in a
previous version of the series which introduced this code
shutdown_reason was an enum so the compiler knew this).

However to be robust it is probably worth adding a default: case to the
switch and logging the unknown shutdown code.

Ian.


Subject: xl: log unknown domain shutdown reason and default to destroy

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 479d042f25e4 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Jul 28 12:07:44 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Wed Jul 28 13:21:16 2010 +0100
@@ -1113,6 +1113,9 @@ static int handle_domain_death(libxl_ctx
     case SHUTDOWN_watchdog:
         action = d_config->on_watchdog;
         break;
+    default:
+        LOG("Unknown shutdown reason code %s. Destroying domain.", 
info->shutdown_reason);
+        action = ACTION_DESTROY;
     }
 
     LOG("Action for shutdown reason code %d is %s", info->shutdown_reason, 
action_on_shutdown_names[action]);


> 
> Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>