File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ static ssize_t host_flen(long fd)
76
76
77
77
static int host_flags_to_mode (int flags )
78
78
{
79
+ static const int modemasks = O_RDONLY | O_WRONLY | O_TEXT | O_RDWR |
80
+ O_CREAT | O_TRUNC | O_APPEND ;
79
81
static const int modeflags [] =
80
82
{
81
83
O_RDONLY | O_TEXT ,
@@ -96,7 +98,7 @@ static int host_flags_to_mode(int flags)
96
98
int i ;
97
99
for (i = 0 ; modeflags [i ] != 0 ; i ++ )
98
100
{
99
- if (modeflags [ i ] == flags )
101
+ if (( modemasks & flags ) == modeflags [ i ] )
100
102
{
101
103
return i ;
102
104
}
Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ static ssize_t host_flen(long fd)
76
76
77
77
static int host_flags_to_mode (int flags )
78
78
{
79
+ static const int modemasks = O_RDONLY | O_WRONLY | O_TEXT | O_RDWR |
80
+ O_CREAT | O_TRUNC | O_APPEND ;
79
81
static const int modeflags [] =
80
82
{
81
83
O_RDONLY | O_TEXT ,
@@ -96,7 +98,7 @@ static int host_flags_to_mode(int flags)
96
98
int i ;
97
99
for (i = 0 ; modeflags [i ] != 0 ; i ++ )
98
100
{
99
- if (modeflags [ i ] == flags )
101
+ if (( modemasks & flags ) == modeflags [ i ] )
100
102
{
101
103
return i ;
102
104
}
Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ static ssize_t host_flen(long fd)
76
76
77
77
static int host_flags_to_mode (int flags )
78
78
{
79
+ static const int modemasks = O_RDONLY | O_WRONLY | O_TEXT | O_RDWR |
80
+ O_CREAT | O_TRUNC | O_APPEND ;
79
81
static const int modeflags [] =
80
82
{
81
83
O_RDONLY | O_TEXT ,
@@ -96,7 +98,7 @@ static int host_flags_to_mode(int flags)
96
98
int i ;
97
99
for (i = 0 ; modeflags [i ] != 0 ; i ++ )
98
100
{
99
- if (modeflags [ i ] == flags )
101
+ if (( modemasks & flags ) == modeflags [ i ] )
100
102
{
101
103
return i ;
102
104
}
You can’t perform that action at this time.
0 commit comments