Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark functions to create a socket from raw fd/socket as unsafe #175

Merged
merged 2 commits into from Dec 3, 2018

Conversation

Projects
None yet
4 participants
@sdroege
Copy link
Member

sdroege commented Dec 1, 2018

It's unsafe as one could pass any possible number as fd/handle here from
safe code otherwise.

Mark functions to create a socket from raw fd/socket as unsafe
It's unsafe as one could pass any possible number as fd/handle here from
safe code otherwise.
@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Dec 1, 2018

Good catch, thanks,
There still needed some work for impl AsXX for Socket generate doc for different system.

@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented Dec 1, 2018

What work do you mean?

@EPashkin

This comment has been minimized.

Copy link
Member

EPashkin commented Dec 1, 2018

Both CI failed on cargo doc --features "dox"

@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented Dec 1, 2018

Ah didn't see that, I'm on the phone right now and the github mobile ui is quite useless for showing such things :)

Will fix later

@sdroege sdroege force-pushed the sdroege:socket-fd-unsafe branch 3 times, most recently from fca1438 to 16866a4 Dec 3, 2018

@sdroege sdroege force-pushed the sdroege:socket-fd-unsafe branch from 16866a4 to 5a5c3b3 Dec 3, 2018

@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented Dec 3, 2018

Finally! All green @GuillaumeGomez :)

@GuillaumeGomez GuillaumeGomez merged commit f380b37 into gtk-rs:master Dec 3, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@philn

This comment has been minimized.

Copy link
Contributor

philn commented Dec 16, 2018

Was it green? cargo build --features=futures,dox fails here:

                                                                                                                                                                                                                  
error[E0605]: non-primitive cast: `i32` as `socket::RawSocket`                                                                                                                                                     
  --> src/socket.rs:64:13                                                                                                                                                                                          
   |                                                                                                                                                                                                               
64 |             ffi::g_socket_get_fd(self.to_glib_none().0) as _                                                                                                                                                  
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                  
   |                                                                                                                                                                                                               
   = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait       
@sdroege

This comment has been minimized.

Copy link
Member Author

sdroege commented Dec 17, 2018

Apparently it was, yes. But I can reproduce that.

vhdirk pushed a commit to vhdirk/gio-rs that referenced this pull request Jan 16, 2019

Merge pull request gtk-rs#175 from sdroege/socket-fd-unsafe
Mark functions to create a socket from raw fd/socket as unsafe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.