Failed writes to block devices don't report an error

Arnout Vandecappelle arnout at mind.be
Fri Jun 25 10:07:30 UTC 2010


On Thursday 24 June 2010 01:12:14, Chris Johns wrote:
> >> This would be good to have. I see it being needed which ever way we
> >> go.
> >>
> >> I also see the following:
> >>    if (write(fd, buf, size) != size)
> >>      goto handle_error
> >>    if (sync_call(..)<  0)
> >>      goto handle_error
> >>
> >> in an application could be a work around until a more standard
> >> approach is made. I prefer this over the other suggestions.
> > 
> > ...which is why I put it as the first one :-)
> 
> If you are using the DOSFS it may pay to check if it has hold of a 
> buffer that may not be flushed. I think there are paths that can result 
> in it holding a buffer. The sync call currently does not touch the file 
> systems.

 sync_call() doesn't, but fsync(fd) does.

 However, I'm not sure if dosfs also syncs the FAT in that case.  It really 
should.

 Regards,
 Arnout
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43



More information about the users mailing list