check ftell return value coverity 1109870

This commit is contained in:
Vincent Sanders 2013-10-25 21:28:58 +01:00
parent f29306cc9a
commit 6b29a697b9
1 changed files with 8 additions and 1 deletions

View File

@ -80,11 +80,18 @@ struct container_ctx {
inline static size_t container_filelen(FILE *fd)
{
long o = ftell(fd);
long o;
long a;
o = ftell(fd);
if (o == -1) {
LOG(("Could not get current stream position"));
return 0;
}
fseek(fd, 0, SEEK_END);
a = ftell(fd);
fseek(fd, o, SEEK_SET);
if (a == -1) {
LOG(("could not ascertain size of file in theme container; omitting"));