.len = 6,
.ptr = (uintptr_t)tag,
};
- int c, fd, s;
+ int c, fd, s, ret;
pid_t child;
pthread_t tid;
struct iovec vec[3];
setlinebuf(stdout);
fd = open(device, O_WRONLY);
+ if (fd < 0) {
+ perror("open");
+ exit(EXIT_FAILURE);
+ }
if (test_mask & BIT(0)) {
vec[0].iov_base = &prio;
}
}
- ioctl(fd, LOGGER_SET_PRIO, prio);
- ioctl(fd, LOGGER_SET_TAG, &struct_tag);
+ ret = ioctl(fd, LOGGER_SET_PRIO, prio);
+ if (ret < 0) {
+ perror("ioctl(SET_PRIO)");
+ exit(EXIT_FAILURE);
+ }
+ ret = ioctl(fd, LOGGER_SET_TAG, &struct_tag);
+ if (ret < 0) {
+ perror("ioctl(SET_TAG)");
+ exit(EXIT_FAILURE);
+ }
if (test_mask & BIT(2)) {
int count;
count = write(fd, "The Foo From STDIO\n", 19);
if (count != 19)
- printf("count != 19\n");
+ fprintf(stderr, "%d != 19\n", count);
write(fd, "LINE #1\nLINE #2", 15);
write(fd, " CONTINUED\nONCE", 15);