rem: read(fd, buf, stat.st_size);
add: rc = read(fd, buf, stat.st_size); if (rc < 0) { printf("Could not read from fortune file: %s\n", strerror(errno)); return -1; }
context: main(void){	int fd;	int rc;	char *buf;	unsigned i;	unsigned found;	struct stat stat;	fd = open(FORTUNES, O_RDONLY, 0);	if (fd < 0) {		printf("Couldn't open %s: %s\n", FORTUNES, strerror(errno));		return -1;	}	rc = fstat(fd, &stat);	if (rc < 0) {		printf("Cookie monster was here!!!\n");		exit(1);	}	buf = malloc(stat.st_size + 1);		read(fd, buf, stat.st_size);	buf[stat.st_size] = 0;	close(fd);	found = 0;	for (i = 0; i < stat.st_size; i++) {		if (!strncmp(buf + i, "#@#", 3))			found += 1;	}	found = 1 + (system_time() % found);	for (i = 0; i < stat.st_size; i++) {		if (!strncmp(buf + i, "#@#", 3))			found -= 1;		if (found == 0) {			unsigned j;			for (j = i + 1; j < stat.st_size; j++) {				if (!strncmp(buf + j, "#@#", 3))					buf[j] = 0;			}			printf("%s\n", buf + i + 3);			break;		}	}	return 0;}