diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2001-07-18 16:56:57 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2001-07-18 16:56:57 +0000 |
commit | de810c391f2ef32edf6106340a274b01b006cdce (patch) | |
tree | 04a438d1fd2398e0f249ce5ea536f625cb98c671 /pfinet/options.c | |
parent | 3b882621b5de27c1c3ee619ea303eb6448459e8f (diff) |
2001-07-13 Neal H Walfield <neal@cs.uml.edu>
* options.c (parse_opt): In the cases where we hold global_lock
and fail, we must release the lock before calling FAIL.
Diffstat (limited to 'pfinet/options.c')
-rw-r--r-- | pfinet/options.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/pfinet/options.c b/pfinet/options.c index 31d9e075..92534982 100644 --- a/pfinet/options.c +++ b/pfinet/options.c @@ -1,6 +1,6 @@ /* Pfinet option parsing - Copyright (C) 1996,97,2000 Free Software Foundation, Inc. + Copyright (C) 1996,97,2000,01 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.org> @@ -253,7 +253,10 @@ parse_opt (int opt, char *arg, struct argp_state *state) err = configure_device (in->device, in->address, in->netmask, in->peer, INADDR_NONE); if (err) - FAIL (err, 16, 0, "cannot configure interface"); + { + __mutex_unlock (&global_lock); + FAIL (err, 16, 0, "cannot configure interface"); + } } /* Set the default gateway. This code is cobbled together from what @@ -289,7 +292,10 @@ parse_opt (int opt, char *arg, struct argp_state *state) { err = - (*tb->tb_delete) (tb, &req.rtm, &rta, &req.nlh, 0); if (err && err != ESRCH) - FAIL (err, 17, 0, "cannot remove old default gateway"); + { + __mutex_unlock (&global_lock); + FAIL (err, 17, 0, "cannot remove old default gateway"); + } err = 0; } } @@ -302,13 +308,15 @@ parse_opt (int opt, char *arg, struct argp_state *state) err = (!tb ? ENOBUFS : - (*tb->tb_insert) (tb, &req.rtm, &rta, &req.nlh, 0)); if (err) - FAIL (err, 17, 0, "cannot set default gateway"); + { + __mutex_unlock (&global_lock); + FAIL (err, 17, 0, "cannot set default gateway"); + } } } __mutex_unlock (&global_lock); - /* Fall through to free hook. */ case ARGP_KEY_ERROR: |