]> granicus.if.org Git - shadow/commitdiff
* lib/groupio.c: Updated splint annotations.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 24 Apr 2009 23:26:31 +0000 (23:26 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Fri, 24 Apr 2009 23:26:31 +0000 (23:26 +0000)
* lib/groupio.c: Added assert to help splint.

ChangeLog
lib/groupio.c

index a7f73601f6e44da4f2c8e53af17fbcf9c4e9de9c..86596f250650719d06d9ad793a5551e402839657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * src/useradd.c: Check assumptions on snprintf().
index fe57d27e105395e74b22839d4804e5935000e7ff..86ee2b1f86a2e5d0da9b63027707200569e8d86f 100644 (file)
@@ -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;