Skip to content

Commit da190a7

Browse files
committed
chore: fix double close for socket fd
Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 2549311 commit da190a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/negative_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ fn test_handling_errors_in_subscriber() {
6565

6666
// SAFETY: safe because `sock2` is a valid Unix socket, as asserted by the `unwrap` above.
6767
unsafe { libc::close(sock2.as_raw_fd()) };
68+
std::mem::forget(sock2);
6869

6970
event_manager.run_with_timeout(100).unwrap();
7071
event_manager.run_with_timeout(100).unwrap();
@@ -82,6 +83,7 @@ fn test_handling_errors_in_subscriber() {
8283

8384
// SAFETY: safe because `sock2` is a valid Unix socket, as asserted by the `unwrap` above.
8485
unsafe { libc::close(sock2.as_raw_fd()) };
86+
std::mem::forget(sock2);
8587

8688
let ready_list_len = event_manager.run_with_timeout(100).unwrap();
8789
assert_eq!(ready_list_len, 2);

0 commit comments

Comments
 (0)