Changeset 1a60fee in mainline for uspace/app/tester/vfs/vfs1.c


Ignore:
Timestamp:
2008-05-15T18:28:50Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4452366
Parents:
e1f51712
Message:

Do not attempt to malloc() zero bytes of memory during VFS_READ at end of file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/vfs/vfs1.c

    re1f51712 r1a60fee  
    8787        char buf[10];
    8888
    89         cnt = read(fd0, buf, sizeof(buf));
    90         if (cnt < 0)
    91                 return "read() failed.\n";
    92 
    93         if (!quiet)
    94                 printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt, buf, fd0);
     89        while ((cnt = read(fd0, buf, sizeof(buf)))) {
     90                if (cnt < 0)
     91                        return "read() failed.\n";
     92                if (!quiet)
     93                        printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt,
     94                            buf, fd0);
     95        }
    9596
    9697        close(fd0);
Note: See TracChangeset for help on using the changeset viewer.