#endif
if (flushb) {
+ errcode_t retval = 0;
#ifdef BLKFLSBUF
if (ioctl (fd, BLKFLSBUF, 0) == 0)
return 0;
+ retval = errno;
#elif defined(__linux__)
#warning BLKFLSBUF not defined
#endif
#ifdef FDFLUSH
- return ioctl(fd, FDFLUSH, 0); /* In case this is a floppy */
+ /* In case this is a floppy */
+ if (ioctl(fd, FDFLUSH, 0) == 0)
+ return 0;
+ if (retval == 0)
+ retval = errno;
#elif defined(__linux__)
#warning FDFLUSH not defined
#endif
+ return retval;
}
return 0;
}