diff --git a/shell/utils.cpp b/shell/utils.cpp index b343520c51c..1fd3ef02a53 100644 --- a/shell/utils.cpp +++ b/shell/utils.cpp @@ -287,7 +287,8 @@ namespace mongo { // port allocator left this socket open to prevent someone else from grabbing // the port -- now we need to close the socket - assert( 0 == close( oldSocket_ ) ); + if ( oldSocket_ > 0 ) + assert( 0 == close( oldSocket_ ) ); fflush( 0 ); pid_ = fork();