* lib/groupio.c: Updated splint annotations.

* lib/groupio.c: Added assert to help splint.
This commit is contained in:
nekral-guest 2009-04-24 23:26:31 +00:00
parent 1a87c69854
commit 08b4253001
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* lib/groupio.c: Updated splint annotations.
* lib/groupio.c: Added assert to help splint.
2009-04-25 Nicolas François <nicolas.francois@centraliens.net> 2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* src/useradd.c: Check assumptions on snprintf(). * src/useradd.c: Check assumptions on snprintf().

View File

@ -44,7 +44,7 @@
#include "groupio.h" #include "groupio.h"
static /*@null@*/struct commonio_entry *merge_group_entries ( static /*@null@*/struct commonio_entry *merge_group_entries (
/*@null@*/struct commonio_entry *gr1, /*@null@*/ /*@returned@*/struct commonio_entry *gr1,
/*@null@*/struct commonio_entry *gr2); /*@null@*/struct commonio_entry *gr2);
static int split_groups (unsigned int max_members); static int split_groups (unsigned int max_members);
static int group_open_hook (void); static int group_open_hook (void);
@ -105,7 +105,7 @@ static struct commonio_ops group_ops = {
group_close_hook group_close_hook
}; };
static struct commonio_db group_db = { static /*@owned@*/struct commonio_db group_db = {
GROUP_FILE, /* filename */ GROUP_FILE, /* filename */
&group_ops, /* ops */ &group_ops, /* ops */
NULL, /* fp */ NULL, /* fp */
@ -193,12 +193,12 @@ void __gr_set_changed (void)
group_db.changed = true; 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; return group_db.head;
} }
struct commonio_db *__gr_get_db (void) /*@observer@*/const struct commonio_db *__gr_get_db (void)
{ {
return &group_db; return &group_db;
} }
@ -265,9 +265,12 @@ static int group_open_hook (void)
if (NULL != gr2->next) { if (NULL != gr2->next) {
gr2->next->prev = gr2->prev; gr2->next->prev = gr2->prev;
} }
/* gr2 does not start with head */
assert (NULL != gr2->prev);
gr2->prev->next = gr2->next; gr2->prev->next = gr2->next;
} }
} }
assert (NULL != gr1);
} }
return 1; return 1;
@ -286,7 +289,7 @@ static int group_open_hook (void)
* set). * set).
*/ */
static /*@null@*/struct commonio_entry *merge_group_entries ( static /*@null@*/struct commonio_entry *merge_group_entries (
/*@null@*/struct commonio_entry *gr1, /*@null@*/ /*@returned@*/struct commonio_entry *gr1,
/*@null@*/struct commonio_entry *gr2) /*@null@*/struct commonio_entry *gr2)
{ {
struct group *gptr1; struct group *gptr1;