File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 17
17
│ PERFORMANCE OF THIS SOFTWARE. │
18
18
╚─────────────────────────────────────────────────────────────────────────────*/
19
19
#include "libc/calls/calls.h"
20
+ #include "libc/calls/struct/stat.h"
20
21
#include "libc/stdio/internal.h"
21
22
#include "libc/stdio/stdio.h"
22
23
#include "libc/sysv/consts/fileno.h"
23
24
#include "libc/sysv/consts/o.h"
25
+ #include "libc/sysv/consts/s.h"
24
26
#include "libc/thread/thread.h"
25
27
26
28
/**
@@ -31,11 +33,14 @@ FILE *stdin;
31
33
static FILE __stdin ;
32
34
33
35
__attribute__((__constructor__ (60 ))) static textstartup void initin (void ) {
36
+ struct stat st ;
34
37
stdin = & __stdin ;
35
38
stdin -> fd = STDIN_FILENO ;
36
39
stdin -> iomode = O_RDONLY ;
37
40
stdin -> buf = stdin -> mem ;
38
41
stdin -> size = sizeof (stdin -> mem );
39
42
stdin -> lock ._type = PTHREAD_MUTEX_RECURSIVE ;
43
+ if (fstat (STDIN_FILENO , & st ) || !S_ISREG (st .st_mode ))
44
+ stdin -> bufmode = _IONBF ;
40
45
__fflush_register (stdin );
41
46
}
You can’t perform that action at this time.
0 commit comments