Quick fix for a crashing bug I just introduced.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15951 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-01-15 18:30:07 +00:00
parent 9c23fc9631
commit 60e5ea42e0

View File

@ -201,12 +201,13 @@ get_fd(struct io_context *context, int fd)
if ((uint32)fd < context->table_size)
descriptor = context->fds[fd];
// Disconnected descriptors cannot be accessed anymore
if (descriptor->open_mode & O_DISCONNECTED)
descriptor = NULL;
if (descriptor != NULL) // fd is valid
atomic_add(&descriptor->ref_count, 1);
if (descriptor != NULL) {
// Disconnected descriptors cannot be accessed anymore
if (descriptor->open_mode & O_DISCONNECTED)
descriptor = NULL;
else
atomic_add(&descriptor->ref_count, 1);
}
mutex_unlock(&context->io_mutex);