Fixed actual bug in set_stat(). Discovered by the gcc from GeekGadgets.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2002-10-06 22:55:32 +00:00
parent a04efc92d0
commit 53bf00c9d5

View File

@ -450,14 +450,14 @@ BPrivate::Storage::set_stat(const char *file, Stat &s, StatMember what)
{
// Grab the previous mod and access times so we only overwrite
// the specified time and not both
Stat *oldStat;
result = ::stat(file, oldStat);
Stat oldStat;
result = ::stat(file, &oldStat);
if (result < 0)
break;
utimbuf buffer;
buffer.actime = (what == WSTAT_ATIME) ? s.st_atime : oldStat->st_atime;
buffer.modtime = (what == WSTAT_MTIME) ? s.st_mtime : oldStat->st_mtime;
buffer.actime = (what == WSTAT_ATIME) ? s.st_atime : oldStat.st_atime;
buffer.modtime = (what == WSTAT_MTIME) ? s.st_mtime : oldStat.st_mtime;
result = ::utime(file, &buffer);
}