More rename fixes.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2217 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-01-20 06:58:13 +00:00
parent 7533e6db28
commit 14277e9b16
2 changed files with 18 additions and 13 deletions
+3 -1
View File
@@ -372,6 +372,8 @@ uio_rename(uio_DirHandle *oldDir, const char *oldPath,
} }
if (uio_mountInfoIsReadOnly(oldReadMountInfo)) { if (uio_mountInfoIsReadOnly(oldReadMountInfo)) {
// XXX: Doesn't uio_getPhysicalAccess already handle this?
// It doesn't return EROFS though; perhaps it should.
uio_PDirHandle_unref(oldPReadDir); uio_PDirHandle_unref(oldPReadDir);
uio_PDirHandle_unref(newPReadDir); uio_PDirHandle_unref(newPReadDir);
uio_PDirHandle_unref(newPWriteDir); uio_PDirHandle_unref(newPWriteDir);
@@ -391,7 +393,7 @@ uio_rename(uio_DirHandle *oldDir, const char *oldPath,
return -1; return -1;
} }
retVal = (oldReadMountInfo->pDirHandle->pRoot->handler->rename)( retVal = (oldReadMountInfo->pDirHandle->pRoot->handler->rename)(
oldPReadDir, oldName, newPReadDir, newName); oldPReadDir, oldName, newPWriteDir, newName);
if (retVal == -1) { if (retVal == -1) {
int savedErrno = errno; int savedErrno = errno;
uio_PDirHandle_unref(oldPReadDir); uio_PDirHandle_unref(oldPReadDir);
+15 -12
View File
@@ -453,7 +453,7 @@ uio_getPhysicalAccess(uio_DirHandle *dirHandle, const char *path,
// unless we intend to create it. // unless we intend to create it.
if (flags & O_CREAT) { if (flags & O_CREAT) {
// The entry does not exist, but we can create it. // The entry does not exist, but we can create it.
readItem = writeItem; // Handled below.
} else { } else {
// O_CREAT was not specified, so we cannot create // O_CREAT was not specified, so we cannot create
// this entry. // this entry.
@@ -494,16 +494,8 @@ uio_getPhysicalAccess(uio_DirHandle *dirHandle, const char *path,
return -1; return -1;
} }
// There exists no path for a write dir, so it will have to be created. // Left is the case where the write location is different from the
// writeMountInfo indicates the physical tree where it should end up. // read location.
if (extraFlags & uio_GPA_NOWRITE) {
// The caller has specified that the path should not be created.
uio_PDirHandle_unref(readPDirHandle);
uio_free(fullPath);
errno = ENOENT;
return -1;
}
pRootPath = uio_mountTreeItemRestPath(writeItem, tree->lastComp, pRootPath = uio_mountTreeItemRestPath(writeItem, tree->lastComp,
fullPath); fullPath);
@@ -515,6 +507,17 @@ uio_getPhysicalAccess(uio_DirHandle *dirHandle, const char *path,
uio_PDirHandle_ref(writeItem->mountInfo->pDirHandle); uio_PDirHandle_ref(writeItem->mountInfo->pDirHandle);
writePDirHandle = writeItem->mountInfo->pDirHandle; writePDirHandle = writeItem->mountInfo->pDirHandle;
} else { } else {
// There exists no path for a write dir, so it will have to be created.
// writeMountInfo indicates the physical tree where it should end up.
if (extraFlags & uio_GPA_NOWRITE) {
// The caller has specified that the path should not be created.
uio_PDirHandle_unref(readPDirHandle);
uio_free(fullPath);
errno = ENOENT;
return -1;
}
writePDirHandle = uio_makePath(writeItem->mountInfo->pDirHandle, writePDirHandle = uio_makePath(writeItem->mountInfo->pDirHandle,
pRootPath, rest - pRootPath, 0777); pRootPath, rest - pRootPath, 0777);
if (writePDirHandle == NULL) { if (writePDirHandle == NULL) {
@@ -550,7 +553,7 @@ uio_getPhysicalAccess(uio_DirHandle *dirHandle, const char *path,
if (readPRootPathPtr != NULL) if (readPRootPathPtr != NULL)
*readPRootPathPtr = joinPathsAbsolute( *readPRootPathPtr = joinPathsAbsolute(
readItem->mountInfo->dirName, readPRootPath); readItem->mountInfo->dirName, readPRootPath);
*mountInfoReadPtr = writeItem->mountInfo; *mountInfoWritePtr = writeItem->mountInfo;
*writePDirHandlePtr = writePDirHandle; *writePDirHandlePtr = writePDirHandle;
if (writePRootPathPtr != NULL) if (writePRootPathPtr != NULL)
*writePRootPathPtr = joinPathsAbsolute( *writePRootPathPtr = joinPathsAbsolute(