File tree 1 file changed +10
-4
lines changed
system/lib/libc/musl/src/fcntl
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 3
3
#include <stdarg.h>
4
4
#include <errno.h>
5
5
#include "syscall.h"
6
+ #include <emscripten/console.h>
6
7
7
- #ifdef __EMSCRIPTEN__
8
- __attribute__((no_sanitize ("address" )))
9
- #endif
10
8
int fcntl (int fd , int cmd , ...)
11
9
{
12
- unsigned long arg ;
10
+ #ifdef __EMSCRIPTEN__
13
11
// XXX Emscripten: According to the va_arg man page it is undefined behaviour to
14
12
// read arguments that are not passed. This can lead to a false positive
15
13
// in SAFE_HEAP, so avoid it.
14
+ unsigned long arg = 0 ;
16
15
if (cmd != F_GETFL && cmd != F_GETFD && cmd != F_GETOWN ) {
17
16
va_list ap ;
18
17
va_start (ap , cmd );
19
18
arg = va_arg (ap , unsigned long );
20
19
va_end (ap );
21
20
}
21
+ #else
22
+ unsigned long arg ;
23
+ va_list ap ;
24
+ va_start (ap , cmd );
25
+ arg = va_arg (ap , unsigned long );
26
+ va_end (ap );
27
+ #endif
22
28
if (cmd == F_SETFL ) arg |= O_LARGEFILE ;
23
29
if (cmd == F_SETLKW ) return syscall_cp (SYS_fcntl , fd , cmd , (void * )arg );
24
30
if (cmd == F_GETOWN ) {
You can’t perform that action at this time.
0 commit comments