X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Ffull-write.c;h=ac27d620959ccea364e9af36028c4f9342eb3a7f;hb=f8bf15285aa9296a754a394291d3e6a3f18ba71f;hp=aa8cff35de79c52c0a128a7db2b848936a5dbcd8;hpb=a5356369542b84bf20c4ea7bf48cec900de31d6a;p=gnulib.git diff --git a/lib/full-write.c b/lib/full-write.c index aa8cff35d..ac27d6209 100644 --- a/lib/full-write.c +++ b/lib/full-write.c @@ -1,5 +1,5 @@ /* 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 @@ -12,20 +12,20 @@ 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 +#if HAVE_CONFIG_H +# include #endif #include -#ifdef HAVE_UNISTD_H -#include +#if HAVE_UNISTD_H +# include #endif #include @@ -34,16 +34,10 @@ extern int errno; #endif /* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted. - Return LEN upon success, write's (negative) error code otherwise. - As the name implies, this function writes all LEN bytes and returns - LEN or it fails and returns the negative value returned by the (final) - failing write. */ + 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; @@ -51,6 +45,10 @@ full_write (desc, ptr, len) 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