Skip to content

Commit

Permalink
Exit with error if write operation fails during activation
Browse files Browse the repository at this point in the history
  • Loading branch information
mbanck-ntap committed Apr 17, 2018
1 parent e18f62c commit 49200b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pg_checksums.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,17 @@ scan_file(char *fn, int segmentno)

/* Seek back to beginning of block */
if (lseek(f, -BLCKSZ, SEEK_CUR) == -1)
{
fprintf(stderr, _("%s: seek failed: %ld\n"), progname, lseek(f, 0, SEEK_CUR));
exit(1);
}

/* Write block with checksum */
if (write(f, buf, BLCKSZ) == -1)
{
fprintf(stderr, _("%s: write failed: %s\n"), progname, strerror(errno));
exit(1);
}
}
}

Expand Down

0 comments on commit 49200b5

Please sign in to comment.