Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Oct 11, 2023
1 parent 3592647 commit 17f8090
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/platform/linux/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,12 @@ impl Device {
});
}

let ctl = Fd::new(libc::socket(AF_INET, SOCK_DGRAM, 0))
.map_err(|_| io::Error::last_os_error())?;

Device {
name: CStr::from_ptr(req.ifr_name.as_ptr())
.to_string_lossy()
.into(),
queues,
ctl,
}
let ctl = Fd::new(libc::socket(AF_INET, SOCK_DGRAM, 0))?;

let name = CStr::from_ptr(req.ifr_name.as_ptr())
.to_string_lossy()
.to_string();
Device { name, queues, ctl }
};

device.configure(config)?;
Expand Down

0 comments on commit 17f8090

Please sign in to comment.