summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Feldman <green@FreeBSD.org>1999-10-30 17:56:47 +0000
committerBrian Feldman <green@FreeBSD.org>1999-10-30 17:56:47 +0000
commit66a84ea76639c93f1fb97caa2a8f91d19759d742 (patch)
treee282abf0f78b67af02ba98c02324172234c4264f
parentcf96af72d5d2278c2a4aa793310d51e6932bd5e6 (diff)
Notes
-rw-r--r--sbin/mount_nfs/mount_nfs.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index 588f14d0bfb3..be1ddadd16db 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -662,6 +662,7 @@ getnfsargs(spec, nfsargsp)
char *cp;
#endif
u_short tport;
+ size_t len;
static struct nfhret nfhret;
static char nam[MNAMELEN + 1];
@@ -685,21 +686,22 @@ getnfsargs(spec, nfsargsp)
* that some mountd implementations fail to remove the mount
* entries from their mountlist while unmounting.
*/
- speclen = strlen(spec);
- while (speclen > 1 && spec[speclen - 1] == '/') {
+ for (speclen = strlen(spec);
+ speclen > 1 && spec[speclen - 1] == '/';
+ speclen--)
spec[speclen - 1] = '\0';
- speclen--;
- }
if (strlen(hostp) + strlen(spec) + 1 > MNAMELEN) {
warnx("%s:%s: %s", hostp, spec, strerror(ENAMETOOLONG));
return (0);
}
-
/* Make both '@' and ':' notations equal */
- strcat(nam, hostp);
- strcat(nam, ":");
- strcat(nam, spec);
-
+ if (*hostp != '\0') {
+ len = strlen(hostp);
+ memmove(nam, hostp, len);
+ nam[len] = ':';
+ memmove(nam + len + 1, spec, speclen);
+ nam[len + speclen + 1] = '\0';
+ }
/*
* DUMB!! Until the mount protocol works on iso transport, we must
* supply both an iso and an inet address for the host.