From e8edfbff2de447873e7ba9cf3019dcb689fe4082 Mon Sep 17 00:00:00 2001 From: wens Date: Wed, 9 Apr 2008 05:59:46 +0000 Subject: Use reentrant strtok_r git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4107 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- daemon/fromd/ip_desc_db.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/fromd/ip_desc_db.c b/daemon/fromd/ip_desc_db.c index 9a399bcb..bd1b85d6 100644 --- a/daemon/fromd/ip_desc_db.c +++ b/daemon/fromd/ip_desc_db.c @@ -20,7 +20,7 @@ int ip_desc_db_reload(const char * cfgfile) { FILE *fp; char buf[256]; - char *ip, *mask; + char *ip, *mask, *strtok_p; db_entry *new_db = NULL; int new_db_len = 0, new_db_size = 0; int result = 0; @@ -33,7 +33,7 @@ int ip_desc_db_reload(const char * cfgfile) if (!buf[0] || buf[0] == '\n') continue; - ip = strtok(buf, " \t\n"); + ip = strtok_r(buf, " \t\n", &strtok_p); if (ip == NULL || *ip == '#' || *ip == '@') continue; @@ -65,7 +65,7 @@ int ip_desc_db_reload(const char * cfgfile) new_db[new_db_len].netmask; // description - if ( (ip = strtok(NULL, " \t\n")) == NULL ) { + if ( (ip = strtok_r(NULL, " \t\n", &strtok_p)) == NULL ) { strcpy(new_db[new_db_len].desc, "¶³²`¤£ª¾³B"); } else { -- cgit v1.2.3