[Pkg-shadow-commits] r2805 - in upstream/trunk: . lib
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sat Apr 25 13:41:52 UTC 2009
Author: nekral-guest
Date: 2009-04-25 13:41:52 +0000 (Sat, 25 Apr 2009)
New Revision: 2805
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/commonio.c
Log:
* lib/commonio.c: Do not assumes eptr is always notnull.
Updated splint annotations.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2009-04-25 13:13:50 UTC (rev 2804)
+++ upstream/trunk/ChangeLog 2009-04-25 13:41:52 UTC (rev 2805)
@@ -1,6 +1,7 @@
2009-04-25 Nicolas François <nicolas.francois at centraliens.net>
* lib/commonio.h, lib/commonio.c: Added splint annotations.
+ * lib/commonio.c: Do not assumes eptr is always notnull.
2009-04-25 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/lib/commonio.c
===================================================================
--- upstream/trunk/lib/commonio.c 2009-04-25 13:13:50 UTC (rev 2804)
+++ upstream/trunk/lib/commonio.c 2009-04-25 13:41:52 UTC (rev 2805)
@@ -64,11 +64,13 @@
static void add_one_entry (struct commonio_db *, /*@owned@*/struct commonio_entry *);
static bool name_is_nis (const char *name);
static int write_all (const struct commonio_db *);
-static struct commonio_entry *find_entry_by_name (struct commonio_db *,
- const char *);
-static struct commonio_entry *next_entry_by_name (struct commonio_db *,
- struct commonio_entry *pos,
- const char *);
+static /*@dependent@*/ /*@null@*/struct commonio_entry *find_entry_by_name (
+ struct commonio_db *,
+ const char *);
+static /*@dependent@*/ /*@null@*/struct commonio_entry *next_entry_by_name (
+ struct commonio_db *,
+ struct commonio_entry *pos,
+ const char *);
static int lock_count = 0;
static bool nscd_need_reload = false;
@@ -703,6 +705,9 @@
for (spw_ptr = shadow->head;
NULL != spw_ptr;
spw_ptr = spw_ptr->next) {
+ if (NULL == spw_ptr->eptr) {
+ continue;
+ }
if (strcmp (name, shadow->ops->getname (spw_ptr->eptr))
== 0) {
break;
@@ -738,6 +743,7 @@
* It returns 0 if all the entries could be written correctly.
*/
static int write_all (const struct commonio_db *db)
+ /*@requires notnull db->fp@*/
{
const struct commonio_entry *p;
void *eptr;
@@ -745,6 +751,7 @@
for (p = db->head; NULL != p; p = p->next) {
if (p->changed) {
eptr = p->eptr;
+ assert (NULL != eptr);
if (db->ops->put (eptr, db->fp) != 0) {
return -1;
}
@@ -762,6 +769,7 @@
int commonio_close (struct commonio_db *db)
+ /*@requires notnull db->fp@*/
{
char buf[1024];
int errors = 0;
@@ -888,9 +896,10 @@
return errors == 0;
}
-static struct commonio_entry *next_entry_by_name (struct commonio_db *db,
- struct commonio_entry *pos,
- const char *name)
+static /*@dependent@*/ /*@null@*/struct commonio_entry *next_entry_by_name (
+ struct commonio_db *db,
+ /*@null@*/struct commonio_entry *pos,
+ const char *name)
{
struct commonio_entry *p;
void *ep;
@@ -909,8 +918,9 @@
return p;
}
-static struct commonio_entry *find_entry_by_name (struct commonio_db *db,
- const char *name)
+static /*@dependent@*/ /*@null@*/struct commonio_entry *find_entry_by_name (
+ struct commonio_db *db,
+ const char *name)
{
return next_entry_by_name(db, db->head, name);
}
More information about the Pkg-shadow-commits
mailing list