diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-06-22 12:40:27 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-06-22 16:04:53 -0400 |
commit | 3ca5879be32c4c11750e12230ff588195fff0738 (patch) | |
tree | 0ec187a74a0c6dade4bea68ac296de28d0cf7606 /utils/exportfs/exportfs.c | |
parent | 94ce1eb94babb4c587b2826452fb053cba745098 (diff) | |
download | nfs-utils-3ca5879be32c4c11750e12230ff588195fff0738.tar.gz nfs-utils-3ca5879be32c4c11750e12230ff588195fff0738.tar.xz nfs-utils-3ca5879be32c4c11750e12230ff588195fff0738.zip |
exportfs: Add a common exit label in exportfs()
Clean up: Reduce code duplication by introducing a goto label for
freeing hp and exiting. This will make replacing "struct hostent *"
with "struct addrinfo *" more straightforward in this code.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/exportfs/exportfs.c')
-rw-r--r-- | utils/exportfs/exportfs.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 83d00a0..50f1e34 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -263,14 +263,10 @@ exportfs(char *arg, char *options, int verbose) if (!exp) { if (!(eep = mkexportent(hname, path, options)) || - !(exp = export_create(eep, 0))) { - if (hp) free (hp); - return; - } - } else if (!updateexportent(&exp->m_export, options)) { - if (hp) free (hp); - return; - } + !(exp = export_create(eep, 0))) + goto out; + } else if (!updateexportent(&exp->m_export, options)) + goto out; if (verbose) printf("exporting %s:%s\n", exp->m_client->m_hostname, @@ -280,6 +276,8 @@ exportfs(char *arg, char *options, int verbose) exp->m_changed = 1; exp->m_warned = 0; validate_export(exp); + +out: if (hp) free (hp); } |