summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/strsubr.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/os/strsubr.c')
-rw-r--r--usr/src/uts/common/os/strsubr.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c
index a7750e2ec3..cd8a0a2a62 100644
--- a/usr/src/uts/common/os/strsubr.c
+++ b/usr/src/uts/common/os/strsubr.c
@@ -1450,7 +1450,6 @@ 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 ||
@@ -1468,23 +1467,18 @@ putiocd(mblk_t *bp, char *arg, int flag, cred_t *cr)
*/
ASSERT(count >= 0);
- 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);
+ 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);
}
+ DB_CPID(tmp) = curproc->p_pid;
+ tmp->b_wptr += count;
+ bp->b_cont = tmp;
return (0);
}