Remove a couple of unused FSServices methods
This commit is contained in:
parent
97a2d44481
commit
01e25eb493
|
@ -290,8 +290,6 @@ class iFSServices
|
|||
virtual bool Rename( const TSTRING& strOldName, const TSTRING& strNewName, bool fOverWrite = true ) const = 0;
|
||||
// rename a file
|
||||
|
||||
virtual bool GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const = 0;
|
||||
virtual bool GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const = 0;
|
||||
virtual bool GetUserName( uid_t user_id, TSTRING& tstrUser ) const = 0;
|
||||
virtual bool GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const = 0;
|
||||
|
||||
|
|
|
@ -497,43 +497,6 @@ void cUnixFSServices::SetResolveNames(bool resolve)
|
|||
mResolveNames=resolve;
|
||||
}
|
||||
|
||||
bool cUnixFSServices::GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const
|
||||
{
|
||||
bool fSuccess = true;
|
||||
|
||||
struct stat statbuf;
|
||||
int ret = lstat(tstrFilename.c_str(), &statbuf);
|
||||
if(ret < 0)
|
||||
{
|
||||
fSuccess = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fSuccess = GetUserName(statbuf.st_uid, tstrUser);
|
||||
}
|
||||
|
||||
return( fSuccess );
|
||||
}
|
||||
|
||||
|
||||
bool cUnixFSServices::GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const
|
||||
{
|
||||
bool fSuccess = true;
|
||||
struct stat statbuf;
|
||||
|
||||
int ret = lstat(tstrFilename.c_str(), &statbuf);
|
||||
if(ret < 0)
|
||||
{
|
||||
fSuccess = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fSuccess = GetGroupName(statbuf.st_gid, tstrGroup);
|
||||
}
|
||||
|
||||
return( fSuccess );
|
||||
}
|
||||
|
||||
|
||||
bool cUnixFSServices::GetUserName( uid_t user_id, TSTRING& tstrUser ) const
|
||||
{
|
||||
|
|
|
@ -132,8 +132,6 @@ class cUnixFSServices : public iFSServices
|
|||
virtual bool Rename( const TSTRING& strOldName, const TSTRING& strNewName, bool fOverWrite = true ) const;
|
||||
// rename a file
|
||||
|
||||
virtual bool GetOwnerForFile( const TSTRING& tstrFilename, TSTRING& tstrUser ) const;
|
||||
virtual bool GetGroupForFile( const TSTRING& tstrFilename, TSTRING& tstrGroup ) const;
|
||||
virtual bool GetUserName( uid_t user_id, TSTRING& tstrUser ) const;
|
||||
virtual bool GetGroupName( gid_t group_id, TSTRING& tstrGroup ) const;
|
||||
|
||||
|
|
|
@ -153,18 +153,6 @@ void TestUnixFSServices()
|
|||
TSTRING newtestfile = _T("/tmp/new.tmp");
|
||||
TEST( pFSServices->Rename( testfile, newtestfile ) );
|
||||
|
||||
// test GetOwnerForFile
|
||||
d.TraceDetail("Testing GetOwnerForFile:\n");
|
||||
TSTRING ownername;
|
||||
TEST( pFSServices->GetOwnerForFile( newtestfile, ownername ) );
|
||||
d.TraceDetail("GetOwnerForFile returned owner %s.\n", ownername.c_str());
|
||||
|
||||
// test GetGroupForFile
|
||||
d.TraceDetail("Testing GetGroupForFile:\n");
|
||||
TSTRING groupname;
|
||||
TEST( pFSServices->GetGroupForFile( newtestfile, groupname ) );
|
||||
d.TraceDetail("GetGroupForFile returned group %s.\n", groupname.c_str());
|
||||
|
||||
// test FileDelete
|
||||
d.TraceDetail("Testing FileDelete:\n");
|
||||
TEST( pFSServices->FileDelete( newtestfile ) );
|
||||
|
|
Loading…
Reference in New Issue