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:
parent
a04efc92d0
commit
53bf00c9d5
@ -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
|
// Grab the previous mod and access times so we only overwrite
|
||||||
// the specified time and not both
|
// the specified time and not both
|
||||||
Stat *oldStat;
|
Stat oldStat;
|
||||||
result = ::stat(file, oldStat);
|
result = ::stat(file, &oldStat);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
utimbuf buffer;
|
utimbuf buffer;
|
||||||
buffer.actime = (what == WSTAT_ATIME) ? s.st_atime : oldStat->st_atime;
|
buffer.actime = (what == WSTAT_ATIME) ? s.st_atime : oldStat.st_atime;
|
||||||
buffer.modtime = (what == WSTAT_MTIME) ? s.st_mtime : oldStat->st_mtime;
|
buffer.modtime = (what == WSTAT_MTIME) ? s.st_mtime : oldStat.st_mtime;
|
||||||
result = ::utime(file, &buffer);
|
result = ::utime(file, &buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user