Added error handling in copy/extract file.

This commit is contained in:
TheFloW 2016-08-21 14:30:40 +02:00
parent 4ba8f5ee52
commit 163f34db05
2 changed files with 20 additions and 2 deletions

View File

@ -210,7 +210,17 @@ int extractArchivePath(char *src, char *dst, uint32_t *value, uint32_t max, void
int read;
while ((read = archiveFileRead(fdsrc, buf, TRANSFER_SIZE)) > 0) {
sceIoWrite(fddst, buf, read);
int res = sceIoWrite(fddst, buf, read);
if (res < 0) {
free(buf);
sceIoClose(fddst);
archiveFileClose(fdsrc);
fileListEmpty(&list);
return res;
}
if (value)
(*value) += read;

10
file.c
View File

@ -241,7 +241,15 @@ int copyFile(char *src_path, char *dst_path, uint32_t *value, uint32_t max, void
int read;
while ((read = sceIoRead(fdsrc, buf, TRANSFER_SIZE)) > 0) {
sceIoWrite(fddst, buf, read);
int res = sceIoWrite(fddst, buf, read);
if (res < 0) {
free(buf);
sceIoClose(fddst);
sceIoClose(fdsrc);
return res;
}
if (value)
(*value) += read;