pmt: initial 2.9.6 release [source]
This commit is contained in:
@@ -29,15 +29,13 @@
|
||||
* If the desired type is not in -1 value is returned.
|
||||
* If the search type is unknown, 3 value is returned
|
||||
*/
|
||||
int PartitionManager::Functions::GetState(const string& filepath, const string& stype)
|
||||
int PartitionManager::GetState(const string& filepath, const string& stype)
|
||||
{
|
||||
static struct stat GetStat;
|
||||
struct stat GetStat;
|
||||
VLOGD("Checking `%s' with 'stat <sys/stat.h>'...\n", filepath.c_str());
|
||||
|
||||
VLOGD("GetStat: checking `%s' with 'stat <sys/stat.h>'...\n", filepath.c_str());
|
||||
if (stat(filepath.c_str(), &GetStat) != 0)
|
||||
return 1;
|
||||
|
||||
if (stype == "dir")
|
||||
if (stat(filepath.c_str(), &GetStat) != 0) return 1;
|
||||
if (stype == "dir")
|
||||
return (S_ISDIR(GetStat.st_mode)) ? 0 : -1;
|
||||
else if (stype == "file")
|
||||
return (S_ISREG(GetStat.st_mode)) ? 0 : -1;
|
||||
@@ -45,10 +43,9 @@ int PartitionManager::Functions::GetState(const string& filepath, const string&
|
||||
return (S_ISBLK(GetStat.st_mode)) ? 0 : -1;
|
||||
else if (stype == "link")
|
||||
return (S_ISLNK(GetStat.st_mode)) ? 0 : -1;
|
||||
else
|
||||
return 3;
|
||||
else return 3;
|
||||
|
||||
return 2;
|
||||
return 2; /* it's a dummy value */
|
||||
}
|
||||
|
||||
/* end of code */
|
||||
|
||||
Reference in New Issue
Block a user