> +
> +void write_file(const char *path, const char *buf, size_t buflen)
> +{
> + int fd;
> + ssize_t numwritten;
> +
> + fd = open(path, O_WRONLY);
> + if (fd == -1)
> + ksft_exit_fail_msg("%s open failed: %s\n", path,
> strerror(errno));
> +
> + numwritten = write(fd, buf, buflen - 1);
> + close(fd);
> + if (numwritten < 1)
> + ksft_exit_fail_msg("Write failed\n");
I guess we could indeed test here easily for
if (numwritten != buflen - 1)
But then, we don't really expect only partial writes to succeed here.
Acked-by: David Hildenbrand (Arm) <[email protected]>
--
Cheers,
David