Changeset 40feeac in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2017-12-03T22:14:40Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e3498b
Parents:
38d150e
Message:

Avoid race condition in vfs_clone().

The file descriptor could have been reallocated between the freeing
and the assigning, which would make it fail spuriously. Avoid
the error by moving deallocation inside the critical section.

File:
1 edited

Legend:

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

    r38d150e r40feeac  
    102102
    103103        if (newfd != -1) {
    104                 /* Make sure newfd is closed. */
    105                 (void) vfs_fd_free(newfd);
    106104                /* Assign the old file to newfd. */
    107105                rc = vfs_fd_assign(oldfile, newfd);
Note: See TracChangeset for help on using the changeset viewer.