summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-10-26 19:45:42 +0000
committerimp <imp@FreeBSD.org>2000-10-26 19:45:42 +0000
commit1d51ceb292ad88c1cd36125f743304b63f08e9f0 (patch)
tree07b4e7baf329d333b7ede57c047d8e8288688715 /sys
parentad616dc95a1bab3fd38f222db10fa6c5398165a3 (diff)
downloadFreeBSD-src-1d51ceb292ad88c1cd36125f743304b63f08e9f0.zip
FreeBSD-src-1d51ceb292ad88c1cd36125f743304b63f08e9f0.tar.gz
Change snprintf to strncpy.
Also add a comment about a bogus assumption in the current code found at bsdcon by jhb.
Diffstat (limited to 'sys')
-rw-r--r--sys/pccard/pccard.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index ca573de..f3d20dc 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -255,8 +255,15 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
goto err;
}
err = device_probe_and_attach(child);
- snprintf(desc->name, sizeof(desc->name), "%s",
- device_get_nameunit(child));
+ /*
+ * XXX We unwisely assume that the detach code won't run while the
+ * XXX the attach code is attaching. Someone should put some
+ * XXX interlock code. This can happen if probe/attach takes a while
+ * XXX and the user ejects the card, which causes the detach
+ * XXX function to be called.
+ */
+ strncpy(desc->name, device_get_nameunit(child), sizeof(desc->name));
+ desc->name[sizeof(desc->name) - 1] = '\0';
err:
if (err)
device_delete_child(pccarddev, child);
OpenPOWER on IntegriCloud