Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
c23d5285
Commit
c23d5285
authored
Jan 21, 2007
by
Dafydd Harries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readline(): fix EOF handling
darcs-hash:20070121024148-c9803-75bac581c823605e337cb9222c0dd68d337338b0.gz
parent
0cd549c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
agent/readline.c
agent/readline.c
+6
-1
agent/test-readline.c
agent/test-readline.c
+12
-3
No files found.
agent/readline.c
View file @
c23d5285
...
...
@@ -18,7 +18,12 @@ readline (guint fileno)
if
(
ret
==
-
1
)
return
NULL
;
if
(
ret
==
0
||
buf
[
i
]
==
'\n'
)
if
(
ret
==
0
&&
i
==
0
)
{
/* EOF on first read */
return
NULL
;
}
else
if
(
ret
==
0
||
buf
[
i
]
==
'\n'
)
{
buf
[
i
]
=
'\0'
;
return
g_strdup
(
buf
);
...
...
agent/test-readline.c
View file @
c23d5285
...
...
@@ -13,9 +13,16 @@ read (int fd, void *buf, size_t count)
gchar
*
line
=
"test
\n
"
;
g_assert
(
count
==
1
);
g_assert
(
offset
<
5
);
*
(
gchar
*
)
buf
=
line
[
offset
++
];
return
1
;
if
(
offset
<
5
)
{
*
(
gchar
*
)
buf
=
line
[
offset
++
];
return
1
;
}
else
{
return
0
;
}
}
int
...
...
@@ -25,6 +32,8 @@ main (void)
line
=
readline
(
0
);
g_assert
(
0
==
strcmp
(
line
,
"test"
));
line
=
readline
(
0
);
g_assert
(
line
==
NULL
);
return
0
;
}
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