From fc656ad7bd57030456c548a813ed1684e5b678ac Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Fri, 24 Apr 2009 23:35:01 +0000 Subject: [PATCH] * lib/commonio.c: Use get_pid() instead of strtol. * lib/commonio.c: Replace an int by a size_t. --- ChangeLog | 5 +++++ lib/commonio.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b71df07..90c2dc7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-25 Nicolas François + + * 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 * lib/commonio.h: Added splint annotations. diff --git a/lib/commonio.c b/lib/commonio.c index 5cfd9bab..afe1e077 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -48,6 +48,7 @@ #include static security_context_t old_context = NULL; #endif +#include "prototypes.h" #include "commonio.h" /* local function prototypes */ @@ -152,9 +153,7 @@ static int do_lock_file (const char *file, const char *lock) return 0; } buf[len] = '\0'; - /* FIXME: use a get_pid */ - pid = strtol (buf, (char **) 0, 10); - if (0 == pid) { + if (get_pid (buf, &pid) == 0) { unlink (file); errno = EINVAL; return 0; @@ -638,7 +637,7 @@ int commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *)) { struct commonio_entry **entries, *ptr; - int n = 0, i; + size_t n = 0, i; for (ptr = db->head; NULL != ptr; ptr = ptr->next) { n++; -- 2.40.0