mirror of
https://github.com/simon987/sist2.git
synced 2025-04-18 17:56:44 +00:00
bugfix with invalid/corrupted index path
This commit is contained in:
parent
fc22e52eae
commit
6931d320a2
@ -54,6 +54,12 @@ index_descriptor_t read_index_descriptor(char *path) {
|
||||
struct stat info;
|
||||
stat(path, &info);
|
||||
int fd = open(path, O_RDONLY);
|
||||
|
||||
if (fd == -1) {
|
||||
fprintf(stderr, "Invalid/corrupt index (Could not find descriptor)");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *buf = malloc(info.st_size + 1);
|
||||
read(fd, buf, info.st_size);
|
||||
*(buf + info.st_size) = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user