* lib/commonio.c: Use get_pid() instead of strtol.

* lib/commonio.c: Replace an int by a size_t.
This commit is contained in:
nekral-guest 2009-04-24 23:35:01 +00:00
parent 1353c71054
commit fc656ad7bd
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* lib/commonio.c: Use get_pid() instead of strtol.
* lib/commonio.c: Replace an int by a size_t.
2009-04-25 Nicolas François <nicolas.francois@centraliens.net> 2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* lib/commonio.h: Added splint annotations. * lib/commonio.h: Added splint annotations.

View File

@ -48,6 +48,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
static security_context_t old_context = NULL; static security_context_t old_context = NULL;
#endif #endif
#include "prototypes.h"
#include "commonio.h" #include "commonio.h"
/* local function prototypes */ /* local function prototypes */
@ -152,9 +153,7 @@ static int do_lock_file (const char *file, const char *lock)
return 0; return 0;
} }
buf[len] = '\0'; buf[len] = '\0';
/* FIXME: use a get_pid */ if (get_pid (buf, &pid) == 0) {
pid = strtol (buf, (char **) 0, 10);
if (0 == pid) {
unlink (file); unlink (file);
errno = EINVAL; errno = EINVAL;
return 0; return 0;
@ -638,7 +637,7 @@ int
commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *)) commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
{ {
struct commonio_entry **entries, *ptr; struct commonio_entry **entries, *ptr;
int n = 0, i; size_t n = 0, i;
for (ptr = db->head; NULL != ptr; ptr = ptr->next) { for (ptr = db->head; NULL != ptr; ptr = ptr->next) {
n++; n++;