@@ -2,7 +2,7 @@ use crate::marker::PhantomData;
2
2
use crate :: mem:: size_of;
3
3
use crate :: os:: windows:: io:: { AsHandle , AsRawHandle , BorrowedHandle } ;
4
4
use crate :: slice;
5
- use crate :: sys:: c ;
5
+ use crate :: sys:: { c , Align8 } ;
6
6
use core;
7
7
use libc;
8
8
@@ -120,21 +120,21 @@ unsafe fn handle_is_console(handle: BorrowedHandle<'_>) -> bool {
120
120
}
121
121
122
122
unsafe fn msys_tty_on ( handle : c:: HANDLE ) -> bool {
123
- let size = size_of :: < c:: FILE_NAME_INFO > ( ) + c:: MAX_PATH * size_of :: < c:: WCHAR > ( ) ;
124
- let mut name_info_bytes = vec ! [ 0u8 ; size ] ;
123
+ const SIZE : usize = size_of :: < c:: FILE_NAME_INFO > ( ) + c:: MAX_PATH * size_of :: < c:: WCHAR > ( ) ;
124
+ let mut name_info_bytes = Align8 ( [ 0u8 ; SIZE ] ) ;
125
125
let res = c:: GetFileInformationByHandleEx (
126
126
handle,
127
127
c:: FileNameInfo ,
128
- name_info_bytes. as_mut_ptr ( ) as * mut libc:: c_void ,
129
- size as u32 ,
128
+ name_info_bytes. 0 . as_mut_ptr ( ) as * mut libc:: c_void ,
129
+ SIZE as u32 ,
130
130
) ;
131
131
if res == 0 {
132
132
return false ;
133
133
}
134
- let name_info: & c:: FILE_NAME_INFO = & * ( name_info_bytes. as_ptr ( ) as * const c:: FILE_NAME_INFO ) ;
134
+ let name_info: & c:: FILE_NAME_INFO = & * ( name_info_bytes. 0 . as_ptr ( ) as * const c:: FILE_NAME_INFO ) ;
135
135
let name_len = name_info. FileNameLength as usize / 2 ;
136
136
// Offset to get the `FileName` field.
137
- let name_ptr = name_info_bytes. as_ptr ( ) . offset ( size_of :: < c:: DWORD > ( ) as isize ) . cast :: < u16 > ( ) ;
137
+ let name_ptr = name_info_bytes. 0 . as_ptr ( ) . offset ( size_of :: < c:: DWORD > ( ) as isize ) . cast :: < u16 > ( ) ;
138
138
let s = core:: slice:: from_raw_parts ( name_ptr, name_len) ;
139
139
let name = String :: from_utf16_lossy ( s) ;
140
140
// This checks whether 'pty' exists in the file name, which indicates that
0 commit comments