summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/strsubr.c
diff options
context:
space:
mode:
authorsuha <none@none>2008-06-23 13:16:14 -0700
committersuha <none@none>2008-06-23 13:16:14 -0700
commit2c5680450e24a9562142739ba7f7143b9b6acef4 (patch)
tree87f0c35921971d6f5ea36daf5de58733565cc136 /usr/src/uts/common/os/strsubr.c
parentbedc1f0fd8ccc14121c30d513080af74115708d0 (diff)
downloadillumos-joyent-2c5680450e24a9562142739ba7f7143b9b6acef4.tar.gz
backout 6711665/6711691: causes 6717918
Diffstat (limited to 'usr/src/uts/common/os/strsubr.c')
-rw-r--r--usr/src/uts/common/os/strsubr.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c
index cd8a0a2a62..a7750e2ec3 100644
--- a/usr/src/uts/common/os/strsubr.c
+++ b/usr/src/uts/common/os/strsubr.c
@@ -1450,6 +1450,7 @@ putiocd(mblk_t *bp, char *arg, int flag, cred_t *cr)
{
mblk_t *tmp;
ssize_t count;
+ size_t n;
int error = 0;
ASSERT((flag & (U_TO_K | K_TO_K)) == U_TO_K ||
@@ -1467,18 +1468,23 @@ putiocd(mblk_t *bp, char *arg, int flag, cred_t *cr)
*/
ASSERT(count >= 0);
- if ((tmp = allocb_cred_wait(count, (flag & STR_NOSIG), &error, cr)) ==
- NULL) {
- return (error);
- }
- error = strcopyin(arg, tmp->b_wptr, count, flag & (U_TO_K|K_TO_K));
- if (error != 0) {
- freeb(tmp);
- return (error);
+ while (count > 0) {
+ n = MIN(MAXIOCBSZ, count);
+ if ((tmp = allocb_cred_wait(n, (flag & STR_NOSIG), &error,
+ cr)) == NULL) {
+ return (error);
+ }
+ error = strcopyin(arg, tmp->b_wptr, n, flag & (U_TO_K|K_TO_K));
+ if (error != 0) {
+ freeb(tmp);
+ return (error);
+ }
+ arg += n;
+ DB_CPID(tmp) = curproc->p_pid;
+ tmp->b_wptr += n;
+ count -= n;
+ bp = (bp->b_cont = tmp);
}
- DB_CPID(tmp) = curproc->p_pid;
- tmp->b_wptr += count;
- bp->b_cont = tmp;
return (0);
}