Subject: [Boost-bugs] [Boost C++ Libraries] #1578: bug in readdir_r_simulator() in a multi-threaded environment
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-01-18 20:38:11
#1578: bug in readdir_r_simulator() in a multi-threaded environment
----------------------------+-----------------------------------------------
Reporter: raulh39_at_[hidden] | Owner: bemandawes
Type: Bugs | Status: new
Milestone: | Component: filesystem
Version: Boost 1.34.1 | Severity: Problem
Keywords: |
----------------------------+-----------------------------------------------
g++, Boost 1.34.1, SunOs 5.7, and a multi-threaded environment.
This program never ends:
{{{
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/foreach.hpp>
#include <iostream>
int main()
{
namespace fs = boost::filesystem;
fs::path path(".",fs::native);
if(fs::exists(path) && fs::is_directory(path))
{
fs::directory_iterator begin(path), end;
BOOST_FOREACH(fs::path file, std::make_pair(begin,end))
std::cout << file.leaf() << std::endl;
}
}
}}}
The problem is that the function readdir_r_simulator() in
boost/libs/filesystem/src/operations.cpp should return != 0 to signal
error, but this line:
{{{
{ return ::readdir_r( dirp, entry, result ); }
}}}
returns 0 when readdir_r() returns NULL, which means an error.
The attached patch should fix the problem.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1578>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC