mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug - File open issue
- If a file (pending.data) is open and locked, trying to open it again caused an error, whereas is now does nothing and reports success. - Corrected timing info in Command::filter.
This commit is contained in:
parent
e403574c34
commit
ad38d5b92e
2 changed files with 20 additions and 17 deletions
27
src/File.cpp
27
src/File.cpp
|
@ -111,20 +111,25 @@ bool File::remove ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool File::open ()
|
||||
{
|
||||
if (data != "" && fh == NULL)
|
||||
if (data != "")
|
||||
{
|
||||
bool already_exists = exists ();
|
||||
if (already_exists)
|
||||
if (!readable () || !writable ())
|
||||
throw std::string (format (STRING_FILE_PERMS, data));
|
||||
|
||||
fh = fopen (data.c_str (), (already_exists ? "r+" : "w+"));
|
||||
if (fh)
|
||||
if (! fh)
|
||||
{
|
||||
h = fileno (fh);
|
||||
locked = false;
|
||||
return true;
|
||||
bool already_exists = exists ();
|
||||
if (already_exists)
|
||||
if (!readable () || !writable ())
|
||||
throw std::string (format (STRING_FILE_PERMS, data));
|
||||
|
||||
fh = fopen (data.c_str (), (already_exists ? "r+" : "w+"));
|
||||
if (fh)
|
||||
{
|
||||
h = fileno (fh);
|
||||
locked = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue