diff options
author | Warner Losh <imp@FreeBSD.org> | 2000-10-26 19:45:42 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2000-10-26 19:45:42 +0000 |
commit | 85cc5e3588387c0af20e347c1813d5579658df66 (patch) | |
tree | 6922db5de66535647d5a6f11dfddc9e8d07f154a /sys | |
parent | bc367918c86d9d5732ce9b0e822af6b798a649a6 (diff) | |
download | src-85cc5e3588387c0af20e347c1813d5579658df66.tar.gz src-85cc5e3588387c0af20e347c1813d5579658df66.zip |
Change snprintf to strncpy.
Also add a comment about a bogus assumption in the current code found at
bsdcon by jhb.
Notes
Notes:
svn path=/head/; revision=67649
Diffstat (limited to 'sys')
-rw-r--r-- | sys/pccard/pccard.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index ca573defb63a..f3d20dc279de 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); |