* lib/gshadow.c, lib/commonio.h: Added splint annotations.

This commit is contained in:
nekral-guest 2009-04-23 11:53:55 +00:00
parent 43033b65ad
commit a121b9b659
3 changed files with 16 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
* lib/gshadow.c, lib/commonio.h: Added splint annotations.
2009-04-22 Nicolas François <nicolas.francois@centraliens.net> 2009-04-22 Nicolas François <nicolas.francois@centraliens.net>
* lib/get_gid.c: gidstr should not be NULL, but the check was * lib/get_gid.c: gidstr should not be NULL, but the check was

View File

@ -58,7 +58,7 @@ struct commonio_ops {
* Make a copy of the object (for example, struct passwd) * Make a copy of the object (for example, struct passwd)
* and all strings pointed by it, in malloced memory. * and all strings pointed by it, in malloced memory.
*/ */
void *(*dup) (const void *); /*@null@*/ /*@only@*/void *(*dup) (const void *);
/* /*
* free() the object including any strings pointed by it. * free() the object including any strings pointed by it.
@ -87,7 +87,7 @@ struct commonio_ops {
* fgets and fputs (can be replaced by versions that * fgets and fputs (can be replaced by versions that
* understand line continuation conventions). * understand line continuation conventions).
*/ */
char *(*fgets) (char *, int, FILE *); /*@null@*/char *(*fgets) (/*@returned@*/ /*@out@*/char *s, int n, FILE *stream);
int (*fputs) (const char *, FILE *); int (*fputs) (const char *, FILE *);
/* /*

View File

@ -40,11 +40,11 @@
#include <stdio.h> #include <stdio.h>
#include "prototypes.h" #include "prototypes.h"
#include "defines.h" #include "defines.h"
static FILE *shadow; static /*@null@*/FILE *shadow;
static char sgrbuf[BUFSIZ * 4]; static char sgrbuf[BUFSIZ * 4];
static char **members = NULL; static /*@null@*//*@only@*/char **members = NULL;
static size_t nmembers = 0; static size_t nmembers = 0;
static char **admins = NULL; static /*@null@*//*@only@*/char **admins = NULL;
static size_t nadmins = 0; static size_t nadmins = 0;
static struct sgrp sgroup; static struct sgrp sgroup;
@ -79,7 +79,7 @@ static int bind_nis (void)
} }
#endif #endif
static char **build_list (char *s, char **list[], size_t * nlist) static /*@null@*/char **build_list (char *s, char **list[], size_t * nlist)
{ {
char **ptr = *list; char **ptr = *list;
size_t nelem = *nlist, size; size_t nelem = *nlist, size;
@ -129,7 +129,7 @@ void endsgent (void)
shadow = (FILE *) 0; shadow = (FILE *) 0;
} }
struct sgrp *sgetsgent (const char *string) /*@observer@*//*@null@*/struct sgrp *sgetsgent (const char *string)
{ {
char *fields[FIELDS]; char *fields[FIELDS];
char *cp; char *cp;
@ -197,7 +197,7 @@ struct sgrp *sgetsgent (const char *string)
* converts it to a (struct sgrp). NULL is returned on EOF. * converts it to a (struct sgrp). NULL is returned on EOF.
*/ */
struct sgrp *fgetsgent (FILE * fp) /*@observer@*//*@null@*/struct sgrp *fgetsgent (/*@null@*/FILE * fp)
{ {
char buf[sizeof sgrbuf]; char buf[sizeof sgrbuf];
char *cp; char *cp;
@ -230,7 +230,7 @@ struct sgrp *fgetsgent (FILE * fp)
* getsgent - get a single shadow group entry * getsgent - get a single shadow group entry
*/ */
struct sgrp *getsgent (void) /*@observer@*//*@null@*/struct sgrp *getsgent (void)
{ {
#ifdef USE_NIS #ifdef USE_NIS
bool nis_1_group = false; bool nis_1_group = false;
@ -329,7 +329,7 @@ struct sgrp *getsgent (void)
* getsgnam - get a shadow group entry by name * getsgnam - get a shadow group entry by name
*/ */
struct sgrp *getsgnam (const char *name) /*@observer@*//*@null@*/struct sgrp *getsgnam (const char *name)
{ {
struct sgrp *sgrp; struct sgrp *sgrp;
@ -452,7 +452,8 @@ int putsgent (const struct sgrp *sgrp, FILE * fp)
strcpy (cp, sgrp->sg_adm[i]); strcpy (cp, sgrp->sg_adm[i]);
cp += strlen (cp); cp += strlen (cp);
} }
*cp++ = ':'; *cp = ':';
cp++;
/* /*
* Now do likewise with the group members. * Now do likewise with the group members.