Skip to content

Commit

Permalink
vis-menu: check read(2) return value
Browse files Browse the repository at this point in the history
Fixes CID 137371
  • Loading branch information
martanne committed Feb 8, 2017
1 parent e43a3f6 commit 4f61acd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vis-menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ readstdin() {

static void
xread(int fd, void *buf, size_t nbyte) {
if (read(fd, buf, nbyte) < 0)
ssize_t r = read(fd, buf, nbyte);
if (r < 0 || (size_t)r != nbyte)
die("Can not read.");
}

Expand Down

0 comments on commit 4f61acd

Please sign in to comment.