id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2542,filesystem: wrong close 0 descriptor in copy_file_api on unix,ai@…,,"This code is wrong if ::stat call fails - it is just close descriptor with number 0 (by if ( infile >= 0 ) ::close( infile );). BOOST_FILESYSTEM_DECL error_code copy_file_api( const std::string & from_file_ph, const std::string & to_file_ph ) { const std::size_t buf_sz = 32768; boost::scoped_array buf( new char [buf_sz] ); int infile=0, outfile=0; // init quiets compiler warning struct stat from_stat; if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 || (infile = ::open( from_file_ph.c_str(), O_RDONLY )) < 0 || (outfile = ::open( to_file_ph.c_str(), O_WRONLY | O_CREAT | O_EXCL, from_stat.st_mode )) < 0 ) { if ( infile >= 0 ) ::close( infile ); return error_code( errno, system_category ); } Fix is just changing int infile=0, outfile=0; // init quiets compiler warning to int infile=-1, outfile=-1; ",Bugs,closed,Boost 1.38.0,None,Boost 1.37.0,Problem,fixed,,