Skip to content

Commit

Permalink
r.thin: Fix unchecked return value in io.c (#4434)
Browse files Browse the repository at this point in the history
check return value
  • Loading branch information
ShubhamDesai authored Oct 3, 2024
1 parent 617828d commit 4bec714
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions raster/r.thin/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ int put_a_row(int row, CELL *buf)

static int read_row(int file, void *buf, int row, int buf_len)
{
lseek(file, ((off_t)row) * buf_len, 0);
if (lseek(file, ((off_t)row) * buf_len, 0) == -1) {
G_fatal_error(_("Unable to seek: %s"), strerror(errno));
}
return (read(file, buf, buf_len) == buf_len);
}

static int write_row(int file, const void *buf, int row, int buf_len)
{
lseek(file, ((off_t)row) * buf_len, 0);
if (lseek(file, ((off_t)row) * buf_len, 0) == -1) {
G_fatal_error(_("Unable to seek: %s"), strerror(errno));
}
return (write(file, buf, buf_len) == buf_len);
}

Expand Down

0 comments on commit 4bec714

Please sign in to comment.