Changeset 0d974d8 in mainline


Ignore:
Timestamp:
2008-10-31T15:59:41Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d861950
Parents:
916bf1a
Message:

fat_read() needs to stop reading beyond the EOF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    r916bf1a r0d974d8  
    539539                 * requested. This keeps the code very simple.
    540540                 */
    541                 bytes = min(len, bps - pos % bps);
    542                 b = fat_block_get(bs, nodep, pos / bps);
    543                 (void) ipc_data_read_finalize(callid, b->data + pos % bps,
    544                     bytes);
    545                 block_put(b);
     541                if (pos >= nodep->size) {
     542                        bytes = 0;              /* reading beyond the EOF */
     543                        (void) ipc_data_read_finalize(callid, NULL, 0);
     544                } else {
     545                        bytes = min(len, bps - pos % bps);
     546                        bytes = min(bytes, nodep->size - pos);
     547                        b = fat_block_get(bs, nodep, pos / bps);
     548                        (void) ipc_data_read_finalize(callid, b->data + pos % bps,
     549                            bytes);
     550                        block_put(b);
     551                }
    546552        } else {
    547553                unsigned bnum;
Note: See TracChangeset for help on using the changeset viewer.