Text  |   XML   |   Visible Warnings:

irssi-0.8.14 : irssi-0.8.14 analysis 2 : Redundant Condition  at servers.c:313

Categories: LANG.STRUCT.RC CWE:570 CWE:571
Warning ID: 5951.28282
Procedure: server_connect_callback_readpipe
Trace: view
Modified: Thu Nov 26 11:08:30 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /kat0/fletcher/SATE/2010/irssi-0.8.14/src/core/servers.c
   Enter server_connect_callback_readpipe
 267 static void server_connect_callback_readpipe(SERVER_REC *server) 
 268 {
 269         RESOLVED_IP_REC iprec;
 270         IPADDR *ip;
 271         const char *errormsg;
 272         char *servername = NULL;
 273  
 274         g_source_remove(server->connect_tag);
 275         server->connect_tag = -1;
 276  
 277         net_gethostbyname_return(server->connect_pipe[0], &iprec);
 278  
 279         g_io_channel_close(server->connect_pipe[0]);
 280         g_io_channel_unref(server->connect_pipe[0]);
 281         g_io_channel_close(server->connect_pipe[1]);
 282         g_io_channel_unref(server->connect_pipe[1]);
 283  
 284         server->connect_pipe[0] = NULL;
 285         server->connect_pipe[1] = NULL;
 286  
 287         /* figure out if we should use IPv4 or v6 address */ 
 288         if (iprec.error != 0) {   /* Redundant Condition (ID: 5947.28284) */
 289                 /* error */ 
 290                 ip = NULL;
 291         } else if (server->connrec->family == AF_INET) {   /* Unreachable Call (ID: 5959.28290) */
 292                 /* force IPv4 connection */ 
 293                 ip = iprec.ip4.family == 0 ? NULL : &iprec.ip4;
 294                 servername = iprec.host4;
 295         } else if (server->connrec->family == AF_INET6) {
 296                 /* force IPv6 connection */ 
 297                 ip = iprec.ip6.family == 0 ? NULL : &iprec.ip6;
 298                 servername = iprec.host6;
 299         } else {
 300                 /* pick the one that was found, or if both do it like 
 301                    /SET resolve_prefer_ipv6 says. */ 
 302                 if (iprec.ip4.family == 0 ||
 303                     (iprec.ip6.family != 0 &&
 304                      settings_get_bool("resolve_prefer_ipv6"))) {
 305                         ip = &iprec.ip6;
 306                         servername = iprec.host6;
 307                 } else {
 308                         ip = &iprec.ip4;
 309                         servername = iprec.host4;
 310                 }
 311         }
 312  
Never True: ip != (void*)0313         if (ip != NULL) {     /* Redundant Condition */
 314                 /* host lookup ok */ 
 315                 if (servername) {   /* Unreachable Call (ID: 5963.28288) */
 316                         g_free(server->connrec->address);
 317                         server->connrec->address = g_strdup(servername);
 318                 }
 319                 server_real_connect(server, ip, NULL);
 320                 errormsg = NULL;
 321         } else {
 322                 if (iprec.error == 0 || net_hosterror_notfound(iprec.error)) {   /* Redundant Condition (ID: 5956.28285) */  /* Redundant Condition (ID: 5954.28286) */
 323                         /* IP wasn't found for the host, don't try to 
 324                            reconnect back to this server */ 
 325                         server->dns_error = TRUE;   /* Unreachable Computation (ID: 5961.28289) */
 326                 }
 327  
 328                 if (iprec.error == 0) {   /* Redundant Condition (ID: 5948.28283) */
 329                         /* forced IPv4 or IPv6 address but it wasn't found */ 
 330                         errormsg = server->connrec->family == AF_INET ?   /* Unreachable Computation (ID: 5966.28287) */
 331                                 "IPv4 address not found for host" : 
 332                                 "IPv6 address not found for host";
 333                 } else {
 334                         /* gethostbyname() failed */ 
 335                         errormsg = iprec.errorstr != NULL ? iprec.errorstr : 
 336                                 "Host lookup failed";
 337                 }
 338  
 339                 server->connection_lost = TRUE;
 340                 server_connect_failed(server, errormsg);
 341         }
 342  
 343         g_free(iprec.errorstr);
 344         g_free(iprec.host4);
 345         g_free(iprec.host6);
 346 } 




Change Warning 5951.28282 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: