Bug fix: The lseek methods of IsoFileSource for local filesystem and loaded ISO returned libisofs error codes as positive off_t numbers
This commit is contained in:
parent
da00291519
commit
2af17490a0
@ -961,18 +961,18 @@ off_t ifs_lseek(IsoFileSource *src, off_t offset, int flag)
|
|||||||
ImageFileSourceData *data;
|
ImageFileSourceData *data;
|
||||||
|
|
||||||
if (src == NULL) {
|
if (src == NULL) {
|
||||||
return (off_t)ISO_NULL_POINTER;
|
return (off_t)((int) ISO_NULL_POINTER);
|
||||||
}
|
}
|
||||||
if (offset < (off_t)0) {
|
if (offset < (off_t)0) {
|
||||||
return (off_t)ISO_WRONG_ARG_VALUE;
|
return (off_t)((int) ISO_WRONG_ARG_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = src->data;
|
data = src->data;
|
||||||
|
|
||||||
if (!data->opened) {
|
if (!data->opened) {
|
||||||
return (off_t)ISO_FILE_NOT_OPENED;
|
return (off_t)((int) ISO_FILE_NOT_OPENED);
|
||||||
} else if (data->opened != 1) {
|
} else if (data->opened != 1) {
|
||||||
return (off_t)ISO_FILE_IS_DIR;
|
return (off_t)((int) ISO_FILE_IS_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
@ -987,7 +987,7 @@ off_t ifs_lseek(IsoFileSource *src, off_t offset, int flag)
|
|||||||
data->data.offset = data->info.st_size + offset;
|
data->data.offset = data->info.st_size + offset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (off_t)ISO_WRONG_ARG_VALUE;
|
return (off_t)((int) ISO_WRONG_ARG_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -337,7 +337,7 @@ off_t lfs_lseek(IsoFileSource *src, off_t offset, int flag)
|
|||||||
int whence;
|
int whence;
|
||||||
|
|
||||||
if (src == NULL) {
|
if (src == NULL) {
|
||||||
return (off_t)ISO_NULL_POINTER;
|
return (off_t)((int) ISO_NULL_POINTER);
|
||||||
}
|
}
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -347,7 +347,7 @@ off_t lfs_lseek(IsoFileSource *src, off_t offset, int flag)
|
|||||||
case 2:
|
case 2:
|
||||||
whence = SEEK_END; break;
|
whence = SEEK_END; break;
|
||||||
default:
|
default:
|
||||||
return (off_t)ISO_WRONG_ARG_VALUE;
|
return (off_t)((int) ISO_WRONG_ARG_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = src->data;
|
data = src->data;
|
||||||
@ -360,19 +360,19 @@ off_t lfs_lseek(IsoFileSource *src, off_t offset, int flag)
|
|||||||
/* error on read */
|
/* error on read */
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ESPIPE:
|
case ESPIPE:
|
||||||
ret = (off_t)ISO_FILE_ERROR;
|
ret = (off_t)((int) ISO_FILE_ERROR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = (off_t)ISO_ERROR;
|
ret = (off_t)((int) ISO_ERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
case 2: /* directory */
|
case 2: /* directory */
|
||||||
return (off_t)ISO_FILE_IS_DIR;
|
return (off_t)((int) ISO_FILE_IS_DIR);
|
||||||
default:
|
default:
|
||||||
return (off_t)ISO_FILE_NOT_OPENED;
|
return (off_t)((int) ISO_FILE_NOT_OPENED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user