Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
5b84acbc
Commit
5b84acbc
authored
Aug 11, 2013
by
Pavel Khlebovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consume \n in mg_fgets when reading from membuf.
parent
c12838e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
mongoose.c
mongoose.c
+7
-4
No files found.
mongoose.c
View file @
5b84acbc
...
...
@@ -2418,10 +2418,13 @@ static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p) {
if
(
filep
->
membuf
!=
NULL
&&
*
p
!=
NULL
)
{
eof
=
(
char
*
)
memchr
(
*
p
,
'\n'
,
&
filep
->
membuf
[
filep
->
size
]
-
*
p
);
len
=
(
size_t
)
(
eof
-
*
p
)
>
size
-
1
?
size
-
1
:
(
size_t
)
(
eof
-
*
p
);
memcpy
(
buf
,
*
p
,
len
);
buf
[
len
]
=
'\0'
;
*
p
=
eof
;
if
(
eof
!=
NULL
)
{
eof
+=
1
;
// Include \n
len
=
(
size_t
)
(
eof
-
*
p
)
>
size
-
1
?
size
-
1
:
(
size_t
)
(
eof
-
*
p
);
memcpy
(
buf
,
*
p
,
len
);
buf
[
len
]
=
'\0'
;
*
p
=
eof
;
}
return
eof
;
}
else
if
(
filep
->
fp
!=
NULL
)
{
return
fgets
(
buf
,
size
,
filep
->
fp
);
...
...
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