diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-07-22 00:05:39 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-07-22 00:05:39 +0200 |
| commit | 5ef40acd1d9bf3b9c94787f3901ef32bd0d3a248 (patch) | |
| tree | 03e59f58d8b30b02369484d66e6829bc06735f29 | |
| parent | 92505f53e239bf6004dec1140b2d5a15b762bb66 (diff) | |
Fix set iovar buffer length.
| -rw-r--r-- | src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs index 0e4a862c5..b06eb36e6 100644 --- a/src/lib.rs +++ b/src/lib.rs | |||
| @@ -422,7 +422,7 @@ impl<'a> Control<'a> { | |||
| 422 | buf[name.len() + 1..][..val.len()].copy_from_slice(val); | 422 | buf[name.len() + 1..][..val.len()].copy_from_slice(val); |
| 423 | 423 | ||
| 424 | let total_len = name.len() + 1 + val.len(); | 424 | let total_len = name.len() + 1 + val.len(); |
| 425 | self.ioctl(2, 263, 0, &mut buf).await; | 425 | self.ioctl(2, 263, 0, &mut buf[..total_len]).await; |
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | // TODO this is not really working, it always returns all zeros. | 428 | // TODO this is not really working, it always returns all zeros. |
| @@ -904,7 +904,7 @@ where | |||
| 904 | let bus = unsafe { &mut *bus }; | 904 | let bus = unsafe { &mut *bus }; |
| 905 | async { | 905 | async { |
| 906 | bus.write(&[cmd]).await?; | 906 | bus.write(&[cmd]).await?; |
| 907 | bus.write(&buf[..(total_len + 3) / 4]).await?; | 907 | bus.write(&buf[..total_len / 4]).await?; |
| 908 | Ok(()) | 908 | Ok(()) |
| 909 | } | 909 | } |
| 910 | }) | 910 | }) |
