blob: 8f76280164adb69204290653ece5cff9dd5a1284 [file] [log] [blame]
Eric Andersendae099b2003-10-09 08:35:42 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +00005 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Eric Andersendae099b2003-10-09 08:35:42 +00006 *
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02007 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
Eric Andersendae099b2003-10-09 08:35:42 +00008 */
9
Eric Andersendae099b2003-10-09 08:35:42 +000010#include "libbb.h"
11
Denis Vlasenkodefc1ea2008-06-27 02:52:20 +000012ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count)
Eric Andersendae099b2003-10-09 08:35:42 +000013{
14 ssize_t n;
15
16 do {
17 n = write(fd, buf, count);
18 } while (n < 0 && errno == EINTR);
19
20 return n;
21}