rem: soff += 512;
add: ssize = 512; write_error = true;
context: dopass (int fd, char const *qname, off_t *sizep, int type,	struct isaac_state *s, unsigned long k, unsigned long n){  off_t size = *sizep;  off_t offset;			/* Current file posiiton */  time_t thresh IF_LINT (= 0);	/* Time to maybe print next status update */  time_t now = 0;		/* Current time */  size_t lim;			/* Amount of data to try writing */  size_t soff;			/* Offset into buffer for next write */  ssize_t ssize;		/* Return value from write */#if ISAAC_WORDS > 1024  word32 r[ISAAC_WORDS * 3];	/* Multiple of 4K and of pattern size */#else  word32 r[1024 * 3];		/* Multiple of 4K and of pattern size */#endif  char pass_string[PASS_NAME_SIZE];	/* Name of current pass */  /* Printable previous offset into the file */  char previous_offset_buf[LONGEST_HUMAN_READABLE + 1];  char const *previous_human_offset IF_LINT (= 0);  if (lseek (fd, (off_t) 0, SEEK_SET) == -1)    {      error (0, errno, _("%s: cannot rewind"), qname);      return -1;    }  /* Constant fill patterns need only be set up once. */  if (type >= 0)    {      lim = sizeof r;      if ((off_t) lim > size && size != -1)	{	  lim = (size_t) size;	}      fillpattern (type, (unsigned char *) r, lim);      passname ((unsigned char *) r, pass_string);    }  else    {      passname (0, pass_string);    }  /* Set position if first status update */  if (n)    {      error (0, 0, _("%s: pass %lu/%lu (%s)..."), qname, k, n, pass_string);      thresh = time (NULL) + VERBOSE_UPDATE;      previous_human_offset = "";    }  offset = 0;  for (;;)    {      /* How much to write this time? */      lim = sizeof r;      if ((off_t) lim > size - offset && size != -1)	{	  if (size < offset)	    break;	  lim = (size_t) (size - offset);	  if (!lim)	    break;	}      if (type < 0)	fillrand (s, r, sizeof r, lim);      /* Loop to retry partial writes. */      for (soff = 0; soff < lim; soff += ssize)	{	  ssize = write (fd, (char *) r + soff, lim - soff);	  if (ssize <= 0)	    {	      if ((ssize == 0 || errno == ENOSPC)		  && size == -1)		{		  /* Ah, we have found the end of the file */		  *sizep = size = offset + soff;		  break;		}	      else		{		  int errnum = errno;		  char buf[INT_BUFSIZE_BOUND (uintmax_t)];		  error (0, errnum, _("%s: error writing at offset %s"),			 qname, umaxtostr ((uintmax_t) offset + soff, buf));		  /*		   * I sometimes use shred on bad media, before throwing it		   * out.  Thus, I don't want it to give up on bad blocks.		   * This code assumes 512-byte blocks and tries to skip		   * over them.  It works because lim is always a multiple		   * of 512, except at the end.		   */		  if (errnum == EIO && soff % 512 == 0 && lim >= soff + 512		      && size != -1)		    {		      if (lseek (fd, (off_t) (offset + soff + 512), SEEK_SET)			  != -1)			{			  soff += 512;			  continue;			}		      error (0, errno, "%s: lseek", qname);		    }		  return -1;		}	    }	}      /* Okay, we have written "soff" bytes. */      if (offset + soff < offset)	{	  error (0, 0, _("%s: file too large"), qname);	  return -1;	}      offset += soff;      /* Time to print progress? */      if (n	  && ((offset == size && *previous_human_offset)	      || thresh <= (now = time (NULL))))	{	  char offset_buf[LONGEST_HUMAN_READABLE + 1];	  char size_buf[LONGEST_HUMAN_READABLE + 1];	  int human_progress_opts = (human_autoscale | human_SI				     | human_base_1024 | human_B);	  char const *human_offset	    = human_readable (offset, offset_buf,			      human_floor | human_progress_opts, 1, 1);	  if (offset == size	      || !STREQ (previous_human_offset, human_offset))	    {	      if (size == -1)		error (0, 0, _("%s: pass %lu/%lu (%s)...%s"),		       qname, k, n, pass_string, human_offset);	      else		{		  uintmax_t off = offset;		  int percent = (size == 0				 ? 100				 : (off <= TYPE_MAXIMUM (uintmax_t) / 100				    ? off * 100 / size				    : off / (size / 100)));		  char const *human_size		    = human_readable (size, size_buf,				      human_ceiling | human_progress_opts,				      1, 1);		  if (offset == size)		    human_offset = human_size;		  error (0, 0, _("%s: pass %lu/%lu (%s)...%s/%s %d%%"),			 qname, k, n, pass_string, human_offset, human_size,			 percent);		}	      strcpy (previous_offset_buf, human_offset);	      previous_human_offset = previous_offset_buf;	      thresh = now + VERBOSE_UPDATE;	      /*	       * Force periodic syncs to keep displayed progress accurate	       * FIXME: Should these be present even if -v is not enabled,	       * to keep the buffer cache from filling with dirty pages?	       * It's a common problem with programs that do lots of writes,	       * like mkfs.	       */	      if (fdatasync (fd) < 0 && fsync (fd) < 0)		{		  error (0, errno, "%s: fsync", qname);		  return -1;		}	    }	}    }  /* Force what we just wrote to hit the media. */  if (fdatasync (fd) < 0 && fsync (fd) < 0)    {      error (0, errno, "%s: fsync", qname);      return -1;    }  return 0;}