* lib/commonio.h, lib/commonio.c: Added splint annotations.
This commit is contained in:
parent
f9bd143012
commit
4c1d96e8e0
@ -1,3 +1,7 @@
|
|||||||
|
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* lib/commonio.h, lib/commonio.c: Added splint annotations.
|
||||||
|
|
||||||
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
|
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* NEWS, po/pt.po: Updated Portuguese translation.
|
* NEWS, po/pt.po: Updated Portuguese translation.
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "nscd.h"
|
#include "nscd.h"
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
static security_context_t old_context = NULL;
|
static /*@null@*/security_context_t old_context = NULL;
|
||||||
#endif
|
#endif
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "commonio.h"
|
#include "commonio.h"
|
||||||
@ -55,7 +55,10 @@ static security_context_t old_context = NULL;
|
|||||||
static int lrename (const char *, const char *);
|
static int lrename (const char *, const char *);
|
||||||
static int check_link_count (const char *file);
|
static int check_link_count (const char *file);
|
||||||
static int do_lock_file (const char *file, const char *lock);
|
static int do_lock_file (const char *file, const char *lock);
|
||||||
static FILE *fopen_set_perms (const char *, const char *, const struct stat *);
|
static /*@null@*/ /*@dependent@*/FILE *fopen_set_perms (
|
||||||
|
const char *name,
|
||||||
|
const char *mode,
|
||||||
|
const struct stat *sb);
|
||||||
static int create_backup (const char *, FILE *);
|
static int create_backup (const char *, FILE *);
|
||||||
static void free_linked_list (struct commonio_db *);
|
static void free_linked_list (struct commonio_db *);
|
||||||
static void add_one_entry (struct commonio_db *, struct commonio_entry *);
|
static void add_one_entry (struct commonio_db *, struct commonio_entry *);
|
||||||
@ -178,8 +181,10 @@ static int do_lock_file (const char *file, const char *lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static FILE *fopen_set_perms (const char *name, const char *mode,
|
static /*@null@*/ /*@dependent@*/FILE *fopen_set_perms (
|
||||||
const struct stat *sb)
|
const char *name,
|
||||||
|
const char *mode,
|
||||||
|
const struct stat *sb)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
mode_t mask;
|
mode_t mask;
|
||||||
@ -488,9 +493,9 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
char *cp;
|
char *cp;
|
||||||
char *line;
|
char *line;
|
||||||
struct commonio_entry *p;
|
struct commonio_entry *p;
|
||||||
void *eptr;
|
void *eptr = NULL;
|
||||||
int flags = mode;
|
int flags = mode;
|
||||||
int buflen;
|
size_t buflen;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
|
|
||||||
mode &= ~O_CREAT;
|
mode &= ~O_CREAT;
|
||||||
@ -542,10 +547,10 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
goto cleanup_ENOMEM;
|
goto cleanup_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (db->ops->fgets (buf, buflen, db->fp) == buf) {
|
while (db->ops->fgets (buf, (int) buflen, db->fp) == buf) {
|
||||||
while ( ((cp = strrchr (buf, '\n')) == NULL)
|
while ( ((cp = strrchr (buf, '\n')) == NULL)
|
||||||
&& (feof (db->fp) == 0)) {
|
&& (feof (db->fp) == 0)) {
|
||||||
int len;
|
size_t len;
|
||||||
|
|
||||||
buflen += BUFLEN;
|
buflen += BUFLEN;
|
||||||
cp = (char *) realloc (buf, buflen);
|
cp = (char *) realloc (buf, buflen);
|
||||||
@ -554,7 +559,9 @@ int commonio_open (struct commonio_db *db, int mode)
|
|||||||
}
|
}
|
||||||
buf = cp;
|
buf = cp;
|
||||||
len = strlen (buf);
|
len = strlen (buf);
|
||||||
if (db->ops->fgets (buf + len, buflen - len, db->fp) == NULL) {
|
if (db->ops->fgets (buf + len,
|
||||||
|
(int) (buflen - len),
|
||||||
|
db->fp) == NULL) {
|
||||||
goto cleanup_buf;
|
goto cleanup_buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ struct commonio_db {
|
|||||||
/*
|
/*
|
||||||
* Currently open file stream.
|
* Currently open file stream.
|
||||||
*/
|
*/
|
||||||
/*@null@*/FILE *fp;
|
/*@dependent@*/ /*@null@*/FILE *fp;
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
/*@null@*/security_context_t scontext;
|
/*@null@*/security_context_t scontext;
|
||||||
|
Loading…
Reference in New Issue
Block a user