diff options
author | Sverker Eriksson <[email protected]> | 2016-07-07 11:33:32 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-07-07 11:33:32 +0200 |
commit | 9026aeebb86396e850a8f6347d1a81f9e2db5918 (patch) | |
tree | e7949a78b6086d41eda84b53f8833ff003092252 /erts/emulator/sys | |
parent | ca4000874a198b218fd62b90e842475d2a0bb8c7 (diff) | |
parent | a9ad9336a33ffbe0979a8e8e34bd69d0d87ede84 (diff) | |
download | otp-9026aeebb86396e850a8f6347d1a81f9e2db5918.tar.gz otp-9026aeebb86396e850a8f6347d1a81f9e2db5918.tar.bz2 otp-9026aeebb86396e850a8f6347d1a81f9e2db5918.zip |
Merge branch 'sverker/spawn-driver-env-test' into maint
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r-- | erts/emulator/sys/unix/sys_drivers.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/erts/emulator/sys/unix/sys_drivers.c b/erts/emulator/sys/unix/sys_drivers.c index 812112fb91..3d7be020e1 100644 --- a/erts/emulator/sys/unix/sys_drivers.c +++ b/erts/emulator/sys/unix/sys_drivers.c @@ -688,6 +688,10 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, return ERL_DRV_ERROR_ERRNO; } + /* + * Whitebox test port_SUITE:pipe_limit_env + * assumes this command payload format. + */ io_vector[i].iov_base = (void*)&buffsz; io_vector[i++].iov_len = sizeof(buffsz); @@ -765,9 +769,14 @@ static ErlDrvData spawn_start(ErlDrvPort port_num, char* name, if (res < (buffsz + sizeof(buffsz))) { /* we only wrote part of the command payload. Enqueue the rest. */ for (i = 0; i < iov_len; i++) { - driver_enq(port_num, io_vector[i].iov_base, io_vector[i].iov_len); + if (res >= io_vector[i].iov_len) + res -= io_vector[i].iov_len; + else { + driver_enq(port_num, io_vector[i].iov_base + res, + io_vector[i].iov_len - res); + res = 0; + } } - driver_deq(port_num, res); driver_select(port_num, ofd[1], ERL_DRV_WRITE|ERL_DRV_USE, 1); } |