Changeset 65737d4 in mainline for uspace/srv/bd/file_bd/file_bd.c


Ignore:
Timestamp:
2010-01-13T20:39:42Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
711e1f32
Parents:
9245413 (diff), fd608dc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/file_bd/file_bd.c

    r9245413 r65737d4  
    205205{
    206206        size_t n_rd;
     207        int rc;
    207208
    208209        fibril_mutex_lock(&dev_lock);
    209210
    210         fseek(img, ba * block_size, SEEK_SET);
     211        clearerr(img);
     212        rc = fseek(img, ba * block_size, SEEK_SET);
     213        if (rc < 0) {
     214                fibril_mutex_unlock(&dev_lock);
     215                return EIO;
     216        }
     217
    211218        n_rd = fread(buf, block_size, cnt, img);
    212219
     
    228235{
    229236        size_t n_wr;
     237        int rc;
    230238
    231239        fibril_mutex_lock(&dev_lock);
    232240
    233         fseek(img, ba * block_size, SEEK_SET);
     241        clearerr(img);
     242        rc = fseek(img, ba * block_size, SEEK_SET);
     243        if (rc < 0) {
     244                fibril_mutex_unlock(&dev_lock);
     245                return EIO;
     246        }
     247
    234248        n_wr = fwrite(buf, block_size, cnt, img);
    235249
     
    237251                fibril_mutex_unlock(&dev_lock);
    238252                return EIO;     /* Write error */
     253        }
     254
     255        if (fflush(img) != 0) {
     256                fibril_mutex_unlock(&dev_lock);
     257                return EIO;
    239258        }
    240259
Note: See TracChangeset for help on using the changeset viewer.