Removed superfluous GetStat() in the setter methods.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8570 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2004-08-14 10:13:20 +00:00
parent 200ec0269e
commit f28fc0257e
+14 -44
View File
@@ -109,14 +109,9 @@ BStatable::GetOwner(uid_t *owner) const
status_t status_t
BStatable::SetOwner(uid_t owner) BStatable::SetOwner(uid_t owner)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); statData.st_uid = owner;
if (error == B_OK) { return set_stat(statData, WSTAT_UID);
statData.st_uid = owner;
error = set_stat(statData, WSTAT_UID);
}
return error;
} }
/*! \brief Returns the group owner of the node. /*! \brief Returns the group owner of the node.
@@ -142,14 +137,9 @@ BStatable::GetGroup(gid_t *group) const
status_t status_t
BStatable::SetGroup(gid_t group) BStatable::SetGroup(gid_t group)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); statData.st_gid = group;
if (error == B_OK) { return set_stat(statData, WSTAT_GID);
statData.st_gid = group;
error = set_stat(statData, WSTAT_GID);
}
return error;
} }
/*! \brief Returns the permissions of the node. /*! \brief Returns the permissions of the node.
@@ -175,14 +165,11 @@ BStatable::GetPermissions(mode_t *perms) const
status_t status_t
BStatable::SetPermissions(mode_t perms) BStatable::SetPermissions(mode_t perms)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); // the FS should do the correct masking -- only the S_IUMSK part is
if (error == B_OK) { // modifiable
statData.st_mode = (statData.st_mode & ~S_IUMSK) | (perms & S_IUMSK); statData.st_mode = perms;
error = set_stat(statData, WSTAT_MODE); return set_stat(statData, WSTAT_MODE);
}
return error;
} }
/*! \brief Get the size of the node's data (not counting attributes). /*! \brief Get the size of the node's data (not counting attributes).
@@ -224,14 +211,9 @@ BStatable::GetModificationTime(time_t *mtime) const
status_t status_t
BStatable::SetModificationTime(time_t mtime) BStatable::SetModificationTime(time_t mtime)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); statData.st_mtime = mtime;
if (error == B_OK) { return set_stat(statData, WSTAT_MTIME);
statData.st_mtime = mtime;
error = set_stat(statData, WSTAT_MTIME);
}
return error;
} }
/*! \brief Returns the time the node was created. /*! \brief Returns the time the node was created.
@@ -257,14 +239,9 @@ BStatable::GetCreationTime(time_t *ctime) const
status_t status_t
BStatable::SetCreationTime(time_t ctime) BStatable::SetCreationTime(time_t ctime)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); statData.st_crtime = ctime;
if (error == B_OK) { return set_stat(statData, WSTAT_CRTIME);
statData.st_crtime = ctime;
error = set_stat(statData, WSTAT_CRTIME);
}
return error;
} }
/*! \brief Returns the time the node was accessed. /*! \brief Returns the time the node was accessed.
@@ -292,14 +269,9 @@ BStatable::GetAccessTime(time_t *atime) const
status_t status_t
BStatable::SetAccessTime(time_t atime) BStatable::SetAccessTime(time_t atime)
{ {
status_t error;
struct stat statData; struct stat statData;
error = GetStat(&statData); statData.st_atime = atime;
if (error == B_OK) { return set_stat(statData, WSTAT_ATIME);
statData.st_atime = atime;
error = set_stat(statData, WSTAT_ATIME);
}
return error;
} }
/*! \brief Returns the volume the node lives on. /*! \brief Returns the volume the node lives on.
@@ -323,5 +295,3 @@ void BStatable::_OhSoStatable1() {}
void BStatable::_OhSoStatable2() {} void BStatable::_OhSoStatable2() {}
void BStatable::_OhSoStatable3() {} void BStatable::_OhSoStatable3() {}