diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-09-16 13:48:38 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-09-16 14:33:51 -0400 |
commit | a8348c2c48d45f991995707fa22a2fa441aaa907 (patch) | |
tree | 06da78ce3d742336406e093f9b89f738fdc7886a | |
parent | 454aea5dad83ca75f3154ff12ecff39169703e69 (diff) | |
download | nfs-utils-a8348c2c48d45f991995707fa22a2fa441aaa907.tar.gz nfs-utils-a8348c2c48d45f991995707fa22a2fa441aaa907.tar.xz nfs-utils-a8348c2c48d45f991995707fa22a2fa441aaa907.zip |
mountd: Add mountlist_freeall()
I'm about to add a second bit of logic that needs to free all
mountlist records, so introduce a helper for freeing them.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/mountd/rmtab.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c index b2c04e7..854d519 100644 --- a/utils/mountd/rmtab.c +++ b/utils/mountd/rmtab.c @@ -173,6 +173,18 @@ out_unlock: xfunlock(lockid); } +static void +mountlist_freeall(mountlist list) +{ + while (list != NULL) { + mountlist m = list; + list = m->ml_next; + xfree(m->ml_hostname); + xfree(m->ml_directory); + xfree(m); + } +} + mountlist mountlist_list(void) { @@ -194,12 +206,7 @@ mountlist_list(void) return NULL; } if (stb.st_mtime != last_mtime) { - while (mlist) { - mlist = (m = mlist)->ml_next; - xfree(m->ml_hostname); - xfree(m->ml_directory); - xfree(m); - } + mountlist_freeall(mlist); last_mtime = stb.st_mtime; setrmtabent("r"); |