Skip to content

Commit

Permalink
check return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Vasudeo Desai committed Oct 2, 2024
1 parent 33d0d15 commit 6a71726
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 6a71726

Please sign in to comment.