@@ -629,14 +629,13 @@ int main(int argc, char **argv)
629
629
}
630
630
631
631
if (strcmp (domname , "dom0" ) == 0 || strcmp (domname , "@adminvm" ) == 0 ) {
632
- if (request_id != NULL ) {
633
- msg_type = MSG_SERVICE_CONNECT ;
634
- strncpy (svc_params .ident , request_id , sizeof (svc_params .ident ) - 1 );
635
- svc_params .ident [sizeof (svc_params .ident ) - 1 ] = '\0' ;
636
- } else {
632
+ if (request_id == NULL ) {
637
633
fprintf (stderr , "ERROR: when target domain is 'dom0', -c must be specified\n" );
638
634
usage (argv [0 ]);
639
635
}
636
+ msg_type = MSG_SERVICE_CONNECT ;
637
+ strncpy (svc_params .ident , request_id , sizeof (svc_params .ident ) - 1 );
638
+ svc_params .ident [sizeof (svc_params .ident ) - 1 ] = '\0' ;
640
639
if (src_domain_name == NULL ) {
641
640
LOG (ERROR , "internal error: src_domain_name should not be NULL here" );
642
641
abort ();
@@ -646,8 +645,8 @@ int main(int argc, char **argv)
646
645
negotiate_connection_params (s ,
647
646
0 , /* dom0 */
648
647
msg_type ,
649
- request_id ? (void * )& svc_params : ( void * ) remote_cmdline ,
650
- request_id ? sizeof (svc_params ) : compute_service_length ( remote_cmdline , argv [ 0 ] ),
648
+ (void * )& svc_params ,
649
+ sizeof (svc_params ),
651
650
& data_domain ,
652
651
& data_port );
653
652
@@ -659,26 +658,20 @@ int main(int argc, char **argv)
659
658
} else {
660
659
prepare_ret = prepare_local_fds (remote_cmdline , & stdin_buffer );
661
660
}
662
- if (request_id ) {
663
- void (* old_handler )(int );
664
-
665
- /* libvchan_client_init is blocking and does not support connection
666
- * timeout, so use alarm(2) for that... */
667
- old_handler = signal (SIGALRM , sigalrm_handler );
668
- alarm (connection_timeout );
669
- data_vchan = libvchan_client_init (data_domain , data_port );
670
- alarm (0 );
671
- signal (SIGALRM , old_handler );
672
- } else {
673
- data_vchan = libvchan_server_init (data_domain , data_port ,
674
- VCHAN_BUFFER_SIZE , VCHAN_BUFFER_SIZE );
675
- wait_for_vchan_client_with_timeout (data_vchan , connection_timeout );
676
- }
661
+ void (* old_handler )(int );
662
+
663
+ /* libvchan_client_init is blocking and does not support connection
664
+ * timeout, so use alarm(2) for that... */
665
+ old_handler = signal (SIGALRM , sigalrm_handler );
666
+ alarm (connection_timeout );
667
+ data_vchan = libvchan_client_init (data_domain , data_port );
668
+ alarm (0 );
669
+ signal (SIGALRM , old_handler );
677
670
if (!data_vchan || !libvchan_is_open (data_vchan )) {
678
671
LOG (ERROR , "Failed to open data vchan connection" );
679
672
exit (1 );
680
673
}
681
- data_protocol_version = handle_agent_handshake (data_vchan , request_id != NULL );
674
+ data_protocol_version = handle_agent_handshake (data_vchan , true );
682
675
if (data_protocol_version < 0 )
683
676
exit (1 );
684
677
if (prepare_ret < 0 )
0 commit comments