Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MINIX

Name: Anonymous 2011-01-22 13:55

That is all.

Name: Anonymous 2011-01-24 9:09

From /src/boot/addaout.c


int copy_data(int srcfd, int dstfd)
{
 char buf[8192];
 ssize_t n;
 int total = 0;

 /* Copy the little bytes themselves. (Source from cp.c). */
 while ((n = read(srcfd, buf, sizeof(buf))) > 0)
 {
  char *bp = buf;
  ssize_t r;
  while (n > 0 && (r= write(dstfd, bp, n)) > 0)
  {
   bp += r;
   n -= r;
   total += r;
  }
  if (r <= 0)
  {
   if (r == 0)
   {
    fprintf(stderr, "Warning: EOF writing to output file.\n");
    return(-1);
   }
  }
 }
 return(total);
}


...


if (r <= 0)
{
 if (r == 0)
 {
  fprintf(stderr, "Warning: EOF writing to output file.\n");
  return(-1);
 }
}


ಠ_ಠ

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List