Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc PR/10499: IWAMOTO Toshihiro: getnetconfig uses ...



details:   https://anonhg.NetBSD.org/src/rev/d2a52662437c
branches:  trunk
changeset: 494193:d2a52662437c
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jul 03 12:08:13 2000 +0000

description:
PR/10499: IWAMOTO Toshihiro: getnetconfig uses strtok. Applied suggested patch
to use strtok_r

diffstat:

 lib/libc/rpc/getnetconfig.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (61 lines):

diff -r 0ad48d18c46d -r d2a52662437c lib/libc/rpc/getnetconfig.c
--- a/lib/libc/rpc/getnetconfig.c       Mon Jul 03 10:16:10 2000 +0000
+++ b/lib/libc/rpc/getnetconfig.c       Mon Jul 03 12:08:13 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnetconfig.c,v 1.1 2000/06/02 23:11:11 fvdl Exp $    */
+/*     $NetBSD: getnetconfig.c,v 1.2 2000/07/03 12:08:13 christos Exp $        */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -519,16 +519,17 @@
 struct netconfig *ncp; /* where to put results */
 {
     char    *tokenp;   /* for processing tokens */
+    char    *lasts;
 
     nc_error = NC_BADFILE;     /* nearly anything that breaks is for this reason */
     stringp[strlen(stringp)-1] = '\0'; /* get rid of newline */
     /* netid */
-    if ((ncp->nc_netid = strtok(stringp, "\t ")) == NULL) {
+    if ((ncp->nc_netid = strtok_r(stringp, "\t ", &lasts)) == NULL) {
        return (-1);
     }
 
     /* semantics */
-    if ((tokenp = strtok(NULL, "\t ")) == NULL) {
+    if ((tokenp = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
     if (strcmp(tokenp, NC_TPI_COTS_ORD_S) == 0)
@@ -543,7 +544,7 @@
        return (-1);
 
     /* flags */
-    if ((tokenp = strtok(NULL, "\t ")) == NULL) {
+    if ((tokenp = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
     for (ncp->nc_flag = NC_NOFLAG; *tokenp != '\0';
@@ -562,18 +563,18 @@
        }
     }
     /* protocol family */
-    if ((ncp->nc_protofmly = strtok(NULL, "\t ")) == NULL) {
+    if ((ncp->nc_protofmly = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
     /* protocol name */
-    if ((ncp->nc_proto = strtok(NULL, "\t ")) == NULL) {
+    if ((ncp->nc_proto = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
     /* network device */
-    if ((ncp->nc_device = strtok(NULL, "\t ")) == NULL) {
+    if ((ncp->nc_device = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
-    if ((tokenp = strtok(NULL, "\t ")) == NULL) {
+    if ((tokenp = strtok_r(NULL, "\t ", &lasts)) == NULL) {
        return (-1);
     }
     if (strcmp(tokenp, NC_NOLOOKUP) == 0) {



Home | Main Index | Thread Index | Old Index