}
perror(filename.c_str());
- exit(1);
+ abort();
}
int ret = fseek(fp, 0, SEEK_END);
if (ret == -1) {
perror("fseek(SEEK_END)");
- exit(1);
+ abort();
}
int disk_size = ftell(fp);
+ if (disk_size == -1) {
+ perror("ftell");
+ abort();
+ }
ret = fseek(fp, 0, SEEK_SET);
if (ret == -1) {
perror("fseek(SEEK_SET)");
- exit(1);
+ abort();
}
string str;
ret = fread(&str[0], disk_size, 1, fp);
if (ret == -1) {
perror("fread");
- exit(1);
+ abort();
}
if (ret == 0) {
fprintf(stderr, "Short read when trying to read %d bytes from %s\n",
disk_size, filename.c_str());
- exit(1);
+ abort();
}
fclose(fp);