#include <string.h>
#if !defined(WIN32)
# include <dirent.h>
-#endif
-#if defined(__FreeBSD__) || defined(__APPLE__)
# include <sys/stat.h>
-#endif // __FreeBSD__
+# include <sys/types.h>
+#endif
#include "cabinet.h"
#include "raw.h"
#include "mszip.h"
#ifndef CAB_READ_ONLY
#if 0
-#ifdef DBG
+#if DBG
void DumpBuffer(void* Buffer, ULONG Size)
{
return CAB_STATUS_CANNOT_READ;
}
- GetFileTimes(SrcFile, FileNode);
+ if (GetFileTimes(SrcFile, FileNode) != CAB_STATUS_SUCCESS)
+ {
+ DPRINT(MIN_TRACE, ("Cannot read file times.\n"));
+ FreeMemory(NewFileName);
+ return CAB_STATUS_CANNOT_READ;
+ }
- GetAttributesOnFile(FileNode);
+ if (GetAttributesOnFile(FileNode) != CAB_STATUS_SUCCESS)
+ {
+ DPRINT(MIN_TRACE, ("Cannot read file attributes.\n"));
+ FreeMemory(NewFileName);
+ return CAB_STATUS_CANNOT_READ;
+ }
CloseFile(SrcFile);
strcpy(buf, File->FileName);
else
{
- getcwd(buf, sizeof(buf));
+ if (!getcwd(buf, sizeof(buf)))
+ return CAB_STATUS_CANNOT_READ;
strcat(buf, DIR_SEPARATOR_STRING);
strcat(buf, File->FileName);
}
strcpy(buf, File->FileName);
else
{
- getcwd(buf, sizeof(buf));
+ if (!getcwd(buf, sizeof(buf)))
+ return CAB_STATUS_CANNOT_READ;
strcat(buf, DIR_SEPARATOR_STRING);
strcat(buf, File->FileName);
}