From: short <> Date: Wed, 3 Dec 2003 01:56:48 +0000 (+0000) Subject: Cope with failing RtlTimeToSecondsSince1970() for atime/mtime/ctime. X-Git-Tag: captive-1_1_3~28 X-Git-Url: http://git.jankratochvil.net/?a=commitdiff_plain;ds=sidebyside;h=913820c7090d9ac1011c4f38be1395800f4fc13f;p=captive.git Cope with failing RtlTimeToSecondsSince1970() for atime/mtime/ctime. - It is not yet clear why RtlTimeToSecondsSince1970() may fail for it. - Bugreport by Graeme/Unit3. --- diff --git a/src/libcaptive/client/directory-slave.c b/src/libcaptive/client/directory-slave.c index e61571e..1a6f6b6 100644 --- a/src/libcaptive/client/directory-slave.c +++ b/src/libcaptive/client/directory-slave.c @@ -222,7 +222,6 @@ static GnomeVFSResult FileIdBothDirInformation_to_GnomeVFSFileInfo(GnomeVFSFileI FILE_ID_BOTH_DIR_INFORMATION *FileIdBothDirInformation,IO_STATUS_BLOCK *IoStatusBlock) { UNICODE_STRING FileName_UnicodeString; -BOOLEAN errBOOLEAN; ULONG tmp_ULONG; g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_GENERIC); @@ -281,29 +280,29 @@ ULONG tmp_ULONG; file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_FLAGS; if (FileIdBothDirInformation->LastAccessTime.QuadPart) { /* it may be 0 if not set */ - errBOOLEAN=RtlTimeToSecondsSince1970(&FileIdBothDirInformation->LastAccessTime,&tmp_ULONG); - g_assert(errBOOLEAN==TRUE); - file_info->atime=tmp_ULONG; - file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_ATIME; + if (RtlTimeToSecondsSince1970(&FileIdBothDirInformation->LastAccessTime,&tmp_ULONG)) { + file_info->atime=tmp_ULONG; + file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_ATIME; + } } /* it may be 0 if not set */ if (FileIdBothDirInformation->LastWriteTime.QuadPart || FileIdBothDirInformation->ChangeTime.QuadPart) { - errBOOLEAN=RtlTimeToSecondsSince1970( + if (RtlTimeToSecondsSince1970( /* take the more recent (==bigger) time: */ (FileIdBothDirInformation->LastWriteTime.QuadPart > FileIdBothDirInformation->ChangeTime.QuadPart ? &FileIdBothDirInformation->LastWriteTime : &FileIdBothDirInformation->ChangeTime), - &tmp_ULONG); - g_assert(errBOOLEAN==TRUE); - file_info->mtime=tmp_ULONG; - file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_MTIME; + &tmp_ULONG)) { + file_info->mtime=tmp_ULONG; + file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_MTIME; + } } if (FileIdBothDirInformation->CreationTime.QuadPart) { /* it may be 0 if not set */ - errBOOLEAN=RtlTimeToSecondsSince1970(&FileIdBothDirInformation->CreationTime,&tmp_ULONG); - g_assert(errBOOLEAN==TRUE); - file_info->ctime=tmp_ULONG; - file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_CTIME; + if (RtlTimeToSecondsSince1970(&FileIdBothDirInformation->CreationTime,&tmp_ULONG)) { + file_info->ctime=tmp_ULONG; + file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_CTIME; + } } return GNOME_VFS_OK;