Skip to content

Commit

Permalink
Clean up return code handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
trommler committed Nov 4, 2012
1 parent 05d6778 commit 8c6728e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/ofsfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int OFSFile::op_create ( mode_t mode )
int fdr=0, fdc=0, nRet = 0;
try
{
// make sure the cache is sync regarding this file
// make sure the cache is in sync regarding this file
update_cache();

if ( get_offline_state() )
Expand All @@ -239,11 +239,13 @@ int OFSFile::op_create ( mode_t mode )
// Sends a signal: Couldn't create file on cache.
OFSBroadcast::Instance().SendError( "FileError", "CacheNotWritable",
"File error: Could not create file on cache.", -errno );
return -errno;
nRet =-errno;
} else {
SyncLogger::Instance().AddEntry ( OFSEnvironment::Instance().getShareID().c_str(),
get_relative_path().c_str(), 'c' );
FilesystemStatusManager::Instance().setsync(false);
nRet = 0;
}
SyncLogger::Instance().AddEntry ( OFSEnvironment::Instance().getShareID().c_str(),
get_relative_path().c_str(), 'c' );
FilesystemStatusManager::Instance().setsync(false);
}
else
{
Expand All @@ -255,21 +257,20 @@ int OFSFile::op_create ( mode_t mode )
// Sends a signal: Couldn't create file on remote share.
OFSBroadcast::Instance().SendError( "FileError", "RemoteNotWritable",
"File error: Could not create file on remote share.",nRet );
///\todo If this failes, move to offline mode
return -errno;
///\todo If this fails, move to offline mode
nRet = -errno;
}
}

fd_remote = fdr;
fd_cache = fdc;

return 0;
}
catch ( OFSException &e )
{
errno = e.get_posixerrno();
return -errno;
nRet = -errno;
}
return nRet;
}

/**
Expand Down

0 comments on commit 8c6728e

Please sign in to comment.