comparison src/core/ngx_connection.c @ 5740:4440438eb086

Core: plugged socket leak during configuration test. This isn't really important as configuration testing shortly ends with a process termination which will free all sockets, though Coverity complains. Prodded by Coverity (CID 400872).
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 26 Jun 2014 03:34:05 +0400
parents f47c844acbd4
children 3377f9459e99
comparison
equal deleted inserted replaced
5739:6e4bb1d6679d 5740:4440438eb086
409 "bind() %V #%d ", &ls[i].addr_text, s); 409 "bind() %V #%d ", &ls[i].addr_text, s);
410 410
411 if (bind(s, ls[i].sockaddr, ls[i].socklen) == -1) { 411 if (bind(s, ls[i].sockaddr, ls[i].socklen) == -1) {
412 err = ngx_socket_errno; 412 err = ngx_socket_errno;
413 413
414 if (err == NGX_EADDRINUSE && ngx_test_config) { 414 if (err != NGX_EADDRINUSE || !ngx_test_config) {
415 continue; 415 ngx_log_error(NGX_LOG_EMERG, log, err,
416 "bind() to %V failed", &ls[i].addr_text);
416 } 417 }
417
418 ngx_log_error(NGX_LOG_EMERG, log, err,
419 "bind() to %V failed", &ls[i].addr_text);
420 418
421 if (ngx_close_socket(s) == -1) { 419 if (ngx_close_socket(s) == -1) {
422 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, 420 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
423 ngx_close_socket_n " %V failed", 421 ngx_close_socket_n " %V failed",
424 &ls[i].addr_text); 422 &ls[i].addr_text);
426 424
427 if (err != NGX_EADDRINUSE) { 425 if (err != NGX_EADDRINUSE) {
428 return NGX_ERROR; 426 return NGX_ERROR;
429 } 427 }
430 428
431 failed = 1; 429 if (!ngx_test_config) {
430 failed = 1;
431 }
432 432
433 continue; 433 continue;
434 } 434 }
435 435
436 #if (NGX_HAVE_UNIX_DOMAIN) 436 #if (NGX_HAVE_UNIX_DOMAIN)