@@ -95,6 +95,10 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
95
95
) ) ) ]
96
96
' poll: {
97
97
use crate :: sys:: os:: errno;
98
+ #[ cfg( not( target_os = "linux" ) ) ]
99
+ use libc:: open as open64;
100
+ #[ cfg( target_os = "linux" ) ]
101
+ use libc:: open64;
98
102
let pfds: & mut [ _ ] = & mut [
99
103
libc:: pollfd { fd : 0 , events : 0 , revents : 0 } ,
100
104
libc:: pollfd { fd : 1 , events : 0 , revents : 0 } ,
@@ -116,7 +120,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
116
120
if pfd. revents & libc:: POLLNVAL == 0 {
117
121
continue ;
118
122
}
119
- if libc :: open ( "/dev/null\0 " . as_ptr ( ) . cast ( ) , libc:: O_RDWR , 0 ) == -1 {
123
+ if open64 ( "/dev/null\0 " . as_ptr ( ) . cast ( ) , libc:: O_RDWR , 0 ) == -1 {
120
124
// If the stream is closed but we failed to reopen it, abort the
121
125
// process. Otherwise we wouldn't preserve the safety of
122
126
// operations on the corresponding Rust object Stdin, Stdout, or
@@ -139,9 +143,13 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
139
143
) ) ) ]
140
144
{
141
145
use crate :: sys:: os:: errno;
146
+ #[ cfg( not( target_os = "linux" ) ) ]
147
+ use libc:: open as open64;
148
+ #[ cfg( target_os = "linux" ) ]
149
+ use libc:: open64;
142
150
for fd in 0 ..3 {
143
151
if libc:: fcntl ( fd, libc:: F_GETFD ) == -1 && errno ( ) == libc:: EBADF {
144
- if libc :: open ( "/dev/null\0 " . as_ptr ( ) . cast ( ) , libc:: O_RDWR , 0 ) == -1 {
152
+ if open64 ( "/dev/null\0 " . as_ptr ( ) . cast ( ) , libc:: O_RDWR , 0 ) == -1 {
145
153
// If the stream is closed but we failed to reopen it, abort the
146
154
// process. Otherwise we wouldn't preserve the safety of
147
155
// operations on the corresponding Rust object Stdin, Stdout, or
0 commit comments