From 89826f41bd5c96e6b13692d03d08049c912b9365 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Mon, 19 Sep 2016 07:01:30 -0400 Subject: [PATCH] Check result of write (thans to Alexander Kapshuk 0) - write(1, buf, n); + while((n = read(fd, buf, sizeof(buf))) > 0) { + if (write(1, buf, n) != n) { + printf(1, "cat: write error\n"); + exit(); + } + } if(n < 0){ printf(1, "cat: read error\n"); exit();