- dsize = lseek(fd, 0, SEEK_END);
- fsize = lseek(IOB.fd, 0, SEEK_END);
-
- FDIOBufferInit(&FDIO, &IOB, fd, fsize + dsize);
+
+ dsize = lseek(outfd, 0, SEEK_END);
+ lseek(outfd, -dsize, SEEK_SET);
+
+ fstat(infd, &statbuf);
+ fsize = statbuf.st_size;
+/*
+ fsize = lseek(infd, 0, SEEK_END);
+*/
+ IOB.fd = infd;
+ FDIOBufferInit(&FDIO, &IOB, outfd, fsize + dsize);