[Ovirt-devel] [PATCH viewer] few minor bugfixes

Mohammed Morsi mmorsi at redhat.com
Mon Jun 1 20:42:08 UTC 2009


Daniel P. Berrange wrote:
> On Mon, Jun 01, 2009 at 11:35:40AM -0400, Mohammed Morsi wrote:
>   
>> +
>> +test -f Makefile && make -k distclean || :
>> +
>> +./autogen.sh
>> +./configure --prefix=$AUTOBUILD_INSTALL_ROOT
>>     
>
> Normally autogen.sh will run configure for you ? If the
> ovirt-viewer script does, then you can just pass the
> --prefix arg straight to autogen.sh and script configure
>
>
>   
Right now the viewer autogen doesn't do much other than running
autoreconf to generate the necessary input files. I've split this bit
out into a separate patch w/ changes to autogen to bring it more inline
w/ the other projects (and resent the original without it).

>> -#if defined(HAVE_SOCKET) && defined(HAVE_CONNECT) && defined(HAVE_HTONS) && defined(HAVE_GETHOSTBYNAME)
>> +#if defined(HAVE_SOCKET) && defined(HAVE_CONNECT) && defined(HAVE_HTONS)
>>  
>>  static int 
>>  viewer_open_vnc_socket(const char* vnchost, int vncport)
>>  {
>>    int socketfd;
>> -  struct hostent *serv;
>>    struct sockaddr_in serv_addr;
>>  
>>    socketfd = socket(PF_INET, SOCK_STREAM, 0);
>> @@ -917,14 +918,9 @@ viewer_open_vnc_socket(const char* vnchost, int vncport)
>>        return -1;
>>    }
>>  
>> -  serv = gethostbyname(vnchost);
>> -  if(serv == NULL){
>> -      return -1;
>> -  }
>> -
>>    serv_addr.sin_family = PF_INET;
>>    serv_addr.sin_port = htons(vncport);
>> -  serv_addr.sin_addr.s_addr = ((struct in_addr *)(serv->h_addr))->s_addr; 
>> +  serv_addr.sin_addr.s_addr = inet_addr(vnchost);
>>  
>>    if (connect(socketfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0){
>>        return -1;
>> @@ -933,7 +929,7 @@ viewer_open_vnc_socket(const char* vnchost, int vncport)
>>    return socketfd;
>>  }
>>     
>
>
> This method should really be re-written to just use getaddrinfo() for
> lookups.
>
>
> Daniel
>   
Not sure what using getaddrinfo gets us here, we're just trying to
connect to the hostname / port that we already have. In any case what
would be setting the service parameter to, since the port which we are
connecting is the autogenerated local tunnel port.

   -Mo




More information about the ovirt-devel mailing list