Skip to content

Commit

Permalink
freebsd network compat layer: fix for hrev45146
Browse files Browse the repository at this point in the history
* MTX_DEF is the default type: it shouldn't be tested against but used
  as the default type.
  • Loading branch information
korli committed Jan 10, 2013
1 parent 4f5a418 commit bf4355a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/libs/compat/freebsd_network/mutex.c
Expand Up @@ -21,14 +21,13 @@ void
mtx_init(struct mtx *mutex, const char *name, const char *type,
int options)
{
if (options & MTX_DEF) {
mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME);
mutex->u.mutex.owner = -1;
} else if (options & MTX_RECURSE) {
if (options & MTX_RECURSE) {
recursive_lock_init_etc(&mutex->u.recursive, name,
MUTEX_FLAG_CLONE_NAME);
} else
panic("fbsd: unsupported mutex type");
} else {
mutex_init_etc(&mutex->u.mutex.lock, name, MUTEX_FLAG_CLONE_NAME);
mutex->u.mutex.owner = -1;
}

mutex->type = options;
}
Expand All @@ -37,10 +36,10 @@ mtx_init(struct mtx *mutex, const char *name, const char *type,
void
mtx_destroy(struct mtx *mutex)
{
if (mutex->type & MTX_DEF)
mutex_destroy(&mutex->u.mutex.lock);
else if (mutex->type & MTX_RECURSE)
if (mutex->type & MTX_RECURSE)
recursive_lock_destroy(&mutex->u.recursive);
else
mutex_destroy(&mutex->u.mutex.lock);
}


Expand Down

0 comments on commit bf4355a

Please sign in to comment.