From 08b4253001ef3de18cd04b53428101f808c4d382 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Fri, 24 Apr 2009 23:26:31 +0000 Subject: [PATCH] * lib/groupio.c: Updated splint annotations. * lib/groupio.c: Added assert to help splint. --- ChangeLog | 5 +++++ lib/groupio.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7f73601..86596f25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-25 Nicolas François + + * lib/groupio.c: Updated splint annotations. + * lib/groupio.c: Added assert to help splint. + 2009-04-25 Nicolas François * src/useradd.c: Check assumptions on snprintf(). diff --git a/lib/groupio.c b/lib/groupio.c index fe57d27e..86ee2b1f 100644 --- a/lib/groupio.c +++ b/lib/groupio.c @@ -44,7 +44,7 @@ #include "groupio.h" static /*@null@*/struct commonio_entry *merge_group_entries ( - /*@null@*/struct commonio_entry *gr1, + /*@null@*/ /*@returned@*/struct commonio_entry *gr1, /*@null@*/struct commonio_entry *gr2); static int split_groups (unsigned int max_members); static int group_open_hook (void); @@ -105,7 +105,7 @@ static struct commonio_ops group_ops = { group_close_hook }; -static struct commonio_db group_db = { +static /*@owned@*/struct commonio_db group_db = { GROUP_FILE, /* filename */ &group_ops, /* ops */ NULL, /* fp */ @@ -193,12 +193,12 @@ void __gr_set_changed (void) group_db.changed = true; } -/*@null@*/struct commonio_entry *__gr_get_head (void) +/*@dependent@*/ /*@null@*/struct commonio_entry *__gr_get_head (void) { return group_db.head; } -struct commonio_db *__gr_get_db (void) +/*@observer@*/const struct commonio_db *__gr_get_db (void) { return &group_db; } @@ -265,9 +265,12 @@ static int group_open_hook (void) if (NULL != gr2->next) { gr2->next->prev = gr2->prev; } + /* gr2 does not start with head */ + assert (NULL != gr2->prev); gr2->prev->next = gr2->next; } } + assert (NULL != gr1); } return 1; @@ -286,7 +289,7 @@ static int group_open_hook (void) * set). */ static /*@null@*/struct commonio_entry *merge_group_entries ( - /*@null@*/struct commonio_entry *gr1, + /*@null@*/ /*@returned@*/struct commonio_entry *gr1, /*@null@*/struct commonio_entry *gr2) { struct group *gptr1;