direct-io.hg

changeset 15273:7f9362a8ae3d

xenapi: Fix segfault in libxenapi.

When calling xen_vbd_set_mode(), libxenapi attempted to convert enum
mode parameter to a string twice - resulting in segfault. Removed
first conversion since conversion is taking place in
marshalling/demarshalling layer. Fixed similar double enum conversion
in other places as well.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author kfraser@localhost.localdomain
date Wed Jun 13 11:27:08 2007 +0100 (2007-06-13)
parents 30449e0e0a64
children ffdbe8aebde2
files tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vm.c
line diff
     1.1 --- a/tools/libxen/src/xen_vbd.c	Wed Jun 13 11:13:11 2007 +0100
     1.2 +++ b/tools/libxen/src/xen_vbd.c	Wed Jun 13 11:27:08 2007 +0100
     1.3 @@ -463,7 +463,7 @@ xen_vbd_set_mode(xen_session *session, x
     1.4              { .type = &abstract_type_string,
     1.5                .u.string_val = vbd },
     1.6              { .type = &xen_vbd_mode_abstract_type_,
     1.7 -              .u.string_val = xen_vbd_mode_to_string(mode) }
     1.8 +              .u.enum_val = mode }
     1.9          };
    1.10  
    1.11      xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL);
    1.12 @@ -479,7 +479,7 @@ xen_vbd_set_type(xen_session *session, x
    1.13              { .type = &abstract_type_string,
    1.14                .u.string_val = vbd },
    1.15              { .type = &xen_vbd_type_abstract_type_,
    1.16 -              .u.string_val = xen_vbd_type_to_string(type) }
    1.17 +              .u.enum_val = type }
    1.18          };
    1.19  
    1.20      xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL);
     2.1 --- a/tools/libxen/src/xen_vm.c	Wed Jun 13 11:13:11 2007 +0100
     2.2 +++ b/tools/libxen/src/xen_vm.c	Wed Jun 13 11:27:08 2007 +0100
     2.3 @@ -1142,7 +1142,7 @@ xen_vm_set_actions_after_shutdown(xen_se
     2.4              { .type = &abstract_type_string,
     2.5                .u.string_val = vm },
     2.6              { .type = &xen_on_normal_exit_abstract_type_,
     2.7 -              .u.string_val = xen_on_normal_exit_to_string(after_shutdown) }
     2.8 +              .u.enum_val = after_shutdown }
     2.9          };
    2.10  
    2.11      xen_call_(session, "VM.set_actions_after_shutdown", param_values, 2, NULL, NULL);
    2.12 @@ -1158,7 +1158,7 @@ xen_vm_set_actions_after_reboot(xen_sess
    2.13              { .type = &abstract_type_string,
    2.14                .u.string_val = vm },
    2.15              { .type = &xen_on_normal_exit_abstract_type_,
    2.16 -              .u.string_val = xen_on_normal_exit_to_string(after_reboot) }
    2.17 +              .u.enum_val = after_reboot }
    2.18          };
    2.19  
    2.20      xen_call_(session, "VM.set_actions_after_reboot", param_values, 2, NULL, NULL);
    2.21 @@ -1174,7 +1174,7 @@ xen_vm_set_actions_after_crash(xen_sessi
    2.22              { .type = &abstract_type_string,
    2.23                .u.string_val = vm },
    2.24              { .type = &xen_on_crash_behaviour_abstract_type_,
    2.25 -              .u.string_val = xen_on_crash_behaviour_to_string(after_crash) }
    2.26 +              .u.enum_val = after_crash }
    2.27          };
    2.28  
    2.29      xen_call_(session, "VM.set_actions_after_crash", param_values, 2, NULL, NULL);