[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Monotone 0.16 bug with filesystems
From: |
Jon Bright |
Subject: |
Re: [Monotone-devel] Monotone 0.16 bug with filesystems |
Date: |
Fri, 07 Jan 2005 08:39:05 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Julio M. Merino Vidal wrote:
long path_max = ::pathconf( ".", _PC_PATH_MAX );
if ( path_max < 1 )
boost::throw_exception(
filesystem_error( "boost::filesystem::current_path",
"_PC_PATH_MAX < 1" ) );
At least on my system, pathconf's allowed to return -1 in a non-error
condition:
------------------------
RETURN VALUE
The limit is returned, if one exists. If the system does not
have a limit for the requested resource, -1 is returned,
and errno is unchanged. If there is an error, -1 is
returned, and errno is set to reflect the nature of the error.
------------------------
I'd guess this means the code should look like:
long path_max;
errno = 0;
path_max = ::pathconf( ".", _PC_PATH_MAX );
if ( path_max < 1 && errno != 0 )
boost::throw_exception(
filesystem_error( "boost::filesystem::current_path",
"_PC_PATH_MAX < 1" ) );
else if ( path_max < 1 )
path_max = _POSIX_PATH_MAX;
--
Jon Bright
Silicon Circus Ltd.
http://www.siliconcircus.com