mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge backout of 3812e7c1b642 Bug 749661 r=red
This commit is contained in:
commit
80ac3f27b8
@ -165,16 +165,8 @@ nsDirEnumeratorUnix : public nsISimpleEnumerator,
|
||||
DIR *mDir;
|
||||
struct dirent *mEntry;
|
||||
nsCString mParentPath;
|
||||
#ifdef ANDROID
|
||||
off_t mNextOffset;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef ANDROID
|
||||
#define YAFFS2_MAGIC 0x5941FF53
|
||||
static uint32_t sFSMagic = 0;
|
||||
#endif
|
||||
|
||||
nsDirEnumeratorUnix::nsDirEnumeratorUnix() :
|
||||
mDir(nsnull),
|
||||
mEntry(nsnull)
|
||||
@ -200,22 +192,6 @@ nsDirEnumeratorUnix::Init(nsLocalFile *parent, bool resolveSymlinks /*ignored*/)
|
||||
if (NS_FAILED(parent->GetNativePath(mParentPath)))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef ANDROID
|
||||
mNextOffset = -1;
|
||||
if (!sFSMagic) {
|
||||
struct STATFS fs;
|
||||
if (!STATFS("/data", &fs)) {
|
||||
sFSMagic = fs.f_type;
|
||||
if (sFSMagic == YAFFS2_MAGIC) {
|
||||
printf_stderr("Using YAFFS2 workarounds");
|
||||
}
|
||||
} else {
|
||||
printf_stderr("Could not determine the fs of /data");
|
||||
sFSMagic = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mDir = opendir(dirPath.get());
|
||||
if (!mDir)
|
||||
return NSRESULT_FOR_ERRNO();
|
||||
@ -245,25 +221,6 @@ nsDirEnumeratorUnix::GetNext(nsISupports **_retval)
|
||||
NS_IMETHODIMP
|
||||
nsDirEnumeratorUnix::GetNextEntry()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
/* Workaround yaffs2 bug
|
||||
*
|
||||
* This is only used on Android if /data is a yaffs2 partition.
|
||||
* However, this workaround would apply to any linux system
|
||||
* unlucky enough to be using yaffs2.
|
||||
*
|
||||
* yaffs2 may reset the offset on readdir calls if we've done something
|
||||
* to a file in the directory since the last call.
|
||||
* This can end up in an infinite loop.
|
||||
*/
|
||||
if (sFSMagic == YAFFS2_MAGIC && mNextOffset >= 0) {
|
||||
// Let yaffs2 clobber the offset
|
||||
mEntry = readdir(mDir);
|
||||
// And then set the right offset we cached from last time
|
||||
lseek(dirfd(mDir), mNextOffset, SEEK_SET);
|
||||
}
|
||||
#endif
|
||||
|
||||
do {
|
||||
errno = 0;
|
||||
mEntry = readdir(mDir);
|
||||
@ -277,14 +234,6 @@ nsDirEnumeratorUnix::GetNextEntry()
|
||||
(mEntry->d_name[1] == '\0' || // .\0
|
||||
(mEntry->d_name[1] == '.' &&
|
||||
mEntry->d_name[2] == '\0'))); // ..\0
|
||||
|
||||
#ifdef ANDROID
|
||||
// Save the correct offset for the next entry
|
||||
if (sFSMagic == YAFFS2_MAGIC) {
|
||||
mNextOffset = lseek(dirfd(mDir), 0, SEEK_CUR);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1042,7 +991,7 @@ nsLocalFile::Remove(bool recursive)
|
||||
rv = file->Remove(recursive);
|
||||
|
||||
#ifdef ANDROID
|
||||
// See bug 580434 - Yaffs2 gives us just deleted files
|
||||
// See bug 580434 - Bionic gives us just deleted files
|
||||
if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
|
||||
continue;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user