Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
089cc781
Commit
089cc781
authored
Aug 21, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 21, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix lookahead buffer usage on pipes.
parent
f42c631d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
file.c
dlls/msvcrt/file.c
+10
-2
file.c
dlls/msvcrt/tests/file.c
+5
-4
No files found.
dlls/msvcrt/file.c
View file @
089cc781
...
@@ -2571,8 +2571,16 @@ static int read_i(int fd, void *buf, unsigned int count)
...
@@ -2571,8 +2571,16 @@ static int read_i(int fd, void *buf, unsigned int count)
if
(
fdinfo
->
wxflag
&
(
WX_PIPE
|
WX_NOSEEK
))
if
(
fdinfo
->
wxflag
&
(
WX_PIPE
|
WX_NOSEEK
))
{
{
fdinfo
->
lookahead
[
0
]
=
lookahead
[
0
];
if
(
lookahead
[
0
]
==
'\n'
&&
(
!
utf16
||
!
lookahead
[
1
]))
fdinfo
->
lookahead
[
1
]
=
lookahead
[
1
];
{
bufstart
[
j
++
]
=
'\n'
;
if
(
utf16
)
bufstart
[
j
++
]
=
0
;
}
else
{
fdinfo
->
lookahead
[
0
]
=
lookahead
[
0
];
fdinfo
->
lookahead
[
1
]
=
lookahead
[
1
];
}
}
}
else
else
SetFilePointer
(
fdinfo
->
handle
,
-
1
-
utf16
,
NULL
,
FILE_CURRENT
);
SetFilePointer
(
fdinfo
->
handle
,
-
1
-
utf16
,
NULL
,
FILE_CURRENT
);
...
...
dlls/msvcrt/tests/file.c
View file @
089cc781
...
@@ -2032,8 +2032,8 @@ static void test_pipes(const char* selfname)
...
@@ -2032,8 +2032,8 @@ static void test_pipes(const char* selfname)
ok
(
0
,
"pipe failed with errno %d
\n
"
,
errno
);
ok
(
0
,
"pipe failed with errno %d
\n
"
,
errno
);
return
;
return
;
}
}
r
=
write
(
pipes
[
1
],
"
\r\n\r
ab
"
,
5
);
r
=
write
(
pipes
[
1
],
"
\r\n\r
ab
\r\n
"
,
7
);
ok
(
r
==
5
,
"write returned %d, errno = %d
\n
"
,
r
,
errno
);
ok
(
r
==
7
,
"write returned %d, errno = %d
\n
"
,
r
,
errno
);
setmode
(
pipes
[
0
],
O_TEXT
);
setmode
(
pipes
[
0
],
O_TEXT
);
r
=
read
(
pipes
[
0
],
buf
,
1
);
r
=
read
(
pipes
[
0
],
buf
,
1
);
ok
(
r
==
1
,
"read returned %d, expected 1
\n
"
,
r
);
ok
(
r
==
1
,
"read returned %d, expected 1
\n
"
,
r
);
...
@@ -2044,9 +2044,10 @@ static void test_pipes(const char* selfname)
...
@@ -2044,9 +2044,10 @@ static void test_pipes(const char* selfname)
r
=
read
(
pipes
[
0
],
buf
,
1
);
r
=
read
(
pipes
[
0
],
buf
,
1
);
ok
(
r
==
1
,
"read returned %d, expected 1
\n
"
,
r
);
ok
(
r
==
1
,
"read returned %d, expected 1
\n
"
,
r
);
ok
(
buf
[
0
]
==
'a'
,
"buf[0] = %x, expected 'a'
\n
"
,
buf
[
0
]);
ok
(
buf
[
0
]
==
'a'
,
"buf[0] = %x, expected 'a'
\n
"
,
buf
[
0
]);
r
=
read
(
pipes
[
0
],
buf
,
1
);
r
=
read
(
pipes
[
0
],
buf
,
2
);
ok
(
r
==
1
,
"read returned %d, expected 1
\n
"
,
r
);
ok
(
r
==
2
,
"read returned %d, expected 1
\n
"
,
r
);
ok
(
buf
[
0
]
==
'b'
,
"buf[0] = %x, expected 'b'
\n
"
,
buf
[
0
]);
ok
(
buf
[
0
]
==
'b'
,
"buf[0] = %x, expected 'b'
\n
"
,
buf
[
0
]);
ok
(
buf
[
1
]
==
'\n'
,
"buf[1] = %x, expected '
\\
n'
\n
"
,
buf
[
1
]);
if
(
p_fopen_s
)
if
(
p_fopen_s
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment