From: Vadim Zeitlin Date: Tue, 30 Oct 2001 15:34:15 +0000 (+0000) Subject: fixed compilation problem in SetTimes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/246c704fca3a07ee5ba89da3a4cc87370f6c8cc9 fixed compilation problem in SetTimes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/filename.cpp b/src/common/filename.cpp index 34fafde83d..d3f34e5aa2 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -899,9 +899,17 @@ bool wxFileName::SetTimes(const wxDateTime *dtCreate, const wxDateTime *dtMod) { #if defined(__UNIX_LIKE__) + if ( !dtAccess && !dtMod ) + { + // can't modify the creation time anyhow, don't try + return TRUE; + } + + // if dtAccess or dtMod is not specified, use the other one (which must be + // non NULL because of the test above) for both times utimbuf utm; - utm.actime = dtAccess ? dtAccess : dtAccess->GetTicks(); - utm.modtime = dtMod ? dtMod : dtMod->GetTicks(); + utm.actime = dtAccess ? dtAccess->GetTicks() : dtMod->GetTicks(); + utm.modtime = dtMod ? dtMod->GetTicks() : dtAccess->GetTicks(); if ( utime(GetFullPath(), &utm) == 0 ) { return TRUE;