Changeset 386e276 in mainline


Ignore:
Timestamp:
2009-05-06T20:57:09Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
66b430e
Parents:
8bb129d
Message:

Negative file descriptors shoud be considered invalid.
This fixes ticket #70.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_file.c

    r8bb129d r386e276  
    104104int vfs_fd_free(int fd)
    105105{
    106         if ((fd >= MAX_OPEN_FILES) || (files[fd] == NULL))
     106        if ((fd < 0) || (fd >= MAX_OPEN_FILES) || (files[fd] == NULL))
    107107                return EBADF;
    108108        vfs_file_delref(files[fd]);
     
    151151vfs_file_t *vfs_file_get(int fd)
    152152{
    153         if (fd < MAX_OPEN_FILES)
     153        if ((fd >= 0) && (fd < MAX_OPEN_FILES))
    154154                return files[fd];
    155155        return NULL;
Note: See TracChangeset for help on using the changeset viewer.