Re: [PATCH] mkswap: when writing the signature page, handle EINTR returns. | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Mon, Apr 14, 2008 at 11:41 PM, Karel Zak <kzak@xxxxxxxxxx> wrote:
> +write_all(int fd, const void *buf, size_t count) {
> + while(count) {
> + ssize_t tmp = write(fd, buf, count);
> +
> + if (tmp > 0) {
> + count -= tmp;
> + if (count)
> + buf += tmp;
>
> + } else if (errno != EINTR && errno != EAGAIN)
> + return -1;
> + }
> + return 0;
You may want to set errno to 0 immediately before the write call.
There is also a suitable function in gnulib with a similar purpose.
I think it's called something like safe_write().
James.
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Site Home] [Netdev] [Ethernet Bridging] [Linux Wireless] [Kernel Newbies] [Memory] [Security] [Linux for Hams] [Netfilter] [Bugtraq] [Rubini] [Photo] [Yosemite] [Yosemite News] [MIPS Linux] [ARM Linux] [Linux RAID] [Linux Admin] [Samba] [Video 4 Linux] [Linux Resources]