Skip to content

Commit

Permalink
Use lseek return value for something
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jul 16, 2024
1 parent 8de87d6 commit 2191631
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ SDB_API int sdb_journal_load(Sdb *s) {
if (sz < 1) {
return 0;
}
lseek (fd, 0, SEEK_SET);
if (lseek (fd, 0, SEEK_SET) == (off_t) -1) {
return 0;
}
str = (char *)sdb_gh_malloc (sz + 1);
if (!str) {
return 0;
Expand Down
5 changes: 4 additions & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,10 @@ static char *slurp(const char *file) {
close (fd);
return NULL;
}
lseek (fd, 0, SEEK_SET);
if (lseek (fd, 0, SEEK_SET) == (off_t)-1) {
close (fd);
return NULL;
}
char *text = (char *)sdb_gh_malloc (sz + 1);
if (!text) {
close (fd);
Expand Down

0 comments on commit 2191631

Please sign in to comment.