Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c77a64f in mainline


Ignore:
Timestamp:
2010-01-10T12:22:14Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
6c01702
Parents:
5f70118
Message:

Must clear error indicator when reading/writing blocks in file_bd, otherwise a read beyond the end of device would render it unusable.

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/io/io.c

    r5f70118 rc77a64f  
    595595}
    596596
     597void clearerr(FILE *stream)
     598{
     599        stream->eof = false;
     600        stream->error = false;
     601}
     602
    597603int fphone(FILE *stream)
    598604{
  • uspace/srv/bd/file_bd/file_bd.c

    r5f70118 rc77a64f  
    208208        fibril_mutex_lock(&dev_lock);
    209209
     210        clearerr(img);
    210211        fseek(img, ba * block_size, SEEK_SET);
    211212        n_rd = fread(buf, block_size, cnt, img);
     
    231232        fibril_mutex_lock(&dev_lock);
    232233
     234        clearerr(img);
    233235        fseek(img, ba * block_size, SEEK_SET);
    234236        n_wr = fwrite(buf, block_size, cnt, img);
Note: See TracChangeset for help on using the changeset viewer.