diff options
author | pjd <pjd@FreeBSD.org> | 2005-10-06 19:04:08 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-10-06 19:04:08 +0000 |
commit | 79642efc0e40a67d48eb1113668d3f65eba70149 (patch) | |
tree | ec00c70ae3bf28093bb1105f6554291e696b1376 /sys/nfsclient | |
parent | 1320dea0a16d5e1b53574aa53fddde116eb8d29c (diff) | |
download | FreeBSD-src-79642efc0e40a67d48eb1113668d3f65eba70149.zip FreeBSD-src-79642efc0e40a67d48eb1113668d3f65eba70149.tar.gz |
- Use strsep() instead of strtok().
- strdup() uses M_WAITOK, so we don't need to check it's return value
against NULL.
MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_diskless.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/nfsclient/nfs_diskless.c b/sys/nfsclient/nfs_diskless.c index 56a5a2f..e17ba0d 100644 --- a/sys/nfsclient/nfs_diskless.c +++ b/sys/nfsclient/nfs_diskless.c @@ -63,15 +63,14 @@ static int decode_nfshandle(char *ev, u_char *fh); static void nfs_parse_options(const char *envopts, struct nfs_diskless *nd) { - char *opts, *o; + char *opts, *o, *otmp; opts = strdup(envopts, M_TEMP); - if (opts == NULL) { - printf("nfs_diskless: cannot allocate memory for options\n"); - return; - } - for (o = strtok(opts, ":;, "); o != NULL; o = strtok(NULL, ":;, ")) { - if (strcmp(o, "soft") == 0) + otmp = opts; + while ((o = strsep(&otmp, ":;, ")) != NULL) { + if (*o == '\0') + ; /* Skip empty options. */ + else if (strcmp(o, "soft") == 0) nd->root_args.flags |= NFSMNT_SOFT; else if (strcmp(o, "intr") == 0) nd->root_args.flags |= NFSMNT_INT; |