Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/other/cat_nonblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int main(int argc, char *argv[])
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
puts("Reads the content of a file, but doesn't wait for input");
exit(-1);
exit(EXIT_FAILURE);
}

/* Open the file for reading in non blocking mode */
Expand All @@ -29,7 +29,7 @@ int main(int argc, char *argv[])
/* If open failed */
if (fd == -1) {
puts(errno == EAGAIN ? "Open would block" : "Open failed");
exit(-1);
exit(EXIT_FAILURE);
}

/* Read the file and output its contents */
Expand All @@ -43,7 +43,7 @@ int main(int argc, char *argv[])
puts("Normally I'd block, but you told me not to");
else
puts("Another read error");
exit(-1);
exit(EXIT_FAILURE);
}

/* Print the characters */
Expand All @@ -55,5 +55,6 @@ int main(int argc, char *argv[])
/* While there are no errors and the file isn't over */
} while (bytes > 0);

close(fd);
return 0;
}