3 void read_or_die(int fd, void *buf, size_t count)
9 loaded = xread(fd, p, count);
11 die("unexpected end of file");
13 die("read error (%s)", strerror(errno));
19 void write_or_die(int fd, const void *buf, size_t count)
25 written = xwrite(fd, p, count);
28 else if (written < 0) {
31 die("write error (%s)", strerror(errno));
38 int write_or_whine(int fd, const void *buf, size_t count, const char *msg)
44 written = xwrite(fd, p, count);
46 fprintf(stderr, "%s: disk full?\n", msg);
49 else if (written < 0) {
52 fprintf(stderr, "%s: write error (%s)\n",
53 msg, strerror(errno));
63 int write_in_full(int fd, const void *buf, size_t count, const char *msg)
69 written = xwrite(fd, p, count);
71 fprintf(stderr, "%s: disk full?\n", msg);
74 else if (written < 0) {
75 fprintf(stderr, "%s: write error (%s)\n",
76 msg, strerror(errno));