Skip to content

Commit

Permalink
xwrite: nop when len=0 / size=0
Browse files Browse the repository at this point in the history
  • Loading branch information
kspalaiologos committed Mar 27, 2023
1 parent bb95910 commit 56c24ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.c
Expand Up @@ -76,6 +76,8 @@ static void help() {
}

static void xwrite(const void * data, size_t size, size_t len, FILE * des) {
if (len == 0 || size == 0)
return;
if (fwrite(data, size, len, des) != len) {
fprintf(stderr, "Write error: %s\n", strerror(errno));
exit(1);
Expand Down

0 comments on commit 56c24ca

Please sign in to comment.