/* full-write.c -- an interface to write that retries after interrupts
- Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Copied largely from GNU C's cccp.c.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+#if HAVE_CONFIG_H
+# include <config.h>
#endif
#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
#endif
#include <errno.h>
Return LEN upon success, write's (negative) error code otherwise. */
int
-full_write (desc, ptr, len)
- int desc;
- char *ptr;
- size_t len;
+full_write (int desc, const char *ptr, size_t len)
{
int total_written;
while (len > 0)
{
int written = write (desc, ptr, len);
+ /* FIXME: write on my slackware Linux 1.2.13 returns zero when
+ I try to write more data than there is room on a floppy disk.
+ This puts dd into an infinite loop. Reproduce with
+ dd if=/dev/zero of=/dev/fd0. */
if (written < 0)
{
#ifdef EINTR