forked from hardcoresushi/DroidFS
Truncate files after possible overwrite
This commit is contained in:
parent
e2539a53b9
commit
2d19895e6d
@ -141,6 +141,7 @@ class FileOperationService : Service() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
encryptedVolume.truncate(dstPath, offset)
|
||||||
encryptedVolume.closeFile(dstFileHandle)
|
encryptedVolume.closeFile(dstFileHandle)
|
||||||
} else {
|
} else {
|
||||||
success = false
|
success = false
|
||||||
|
@ -77,6 +77,7 @@ abstract class EncryptedVolume: Parcelable {
|
|||||||
abstract fun read(fileHandle: Long, buffer: ByteArray, offset: Long): Int
|
abstract fun read(fileHandle: Long, buffer: ByteArray, offset: Long): Int
|
||||||
abstract fun write(fileHandle: Long, offset: Long, buffer: ByteArray, size: Int): Int
|
abstract fun write(fileHandle: Long, offset: Long, buffer: ByteArray, size: Int): Int
|
||||||
abstract fun closeFile(fileHandle: Long): Boolean
|
abstract fun closeFile(fileHandle: Long): Boolean
|
||||||
|
// Due to gocryptfs internals, truncate requires the file to be open before it is called
|
||||||
abstract fun truncate(path: String, size: Long): Boolean
|
abstract fun truncate(path: String, size: Long): Boolean
|
||||||
abstract fun deleteFile(path: String): Boolean
|
abstract fun deleteFile(path: String): Boolean
|
||||||
abstract fun readDir(path: String): MutableList<ExplorerElement>?
|
abstract fun readDir(path: String): MutableList<ExplorerElement>?
|
||||||
@ -142,6 +143,7 @@ abstract class EncryptedVolume: Parcelable {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
truncate(dst_path, offset)
|
||||||
closeFile(dstfileHandle)
|
closeFile(dstfileHandle)
|
||||||
inputStream.close()
|
inputStream.close()
|
||||||
return success
|
return success
|
||||||
|
Loading…
Reference in New Issue
Block a user