mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
virStream: Forbid negative seeks
Currently, we don't assign any meaning to that. Our current view on virStream is that it's merely a pipe. And pipes don't support seeking. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
445a340bd4
commit
0da4a635bc
@ -527,6 +527,13 @@
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckPositiveArgReturn(argname, retval) \
|
||||
do { \
|
||||
if (argname <= 0) { \
|
||||
virReportInvalidPositiveArg(argname); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckNonZeroArgGoto(argname, label) \
|
||||
do { \
|
||||
if (argname == 0) { \
|
||||
|
@ -367,6 +367,7 @@ virNetClientStreamSetHole(virNetClientStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
virCheckFlags(0, -1);
|
||||
virCheckPositiveArgReturn(length, -1);
|
||||
|
||||
/* Shouldn't happen, But it's better to safe than sorry. */
|
||||
if (st->holeLength) {
|
||||
|
@ -950,6 +950,7 @@ virFDStreamSendHole(virStreamPtr st,
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
virCheckPositiveArgReturn(length, -1);
|
||||
|
||||
virObjectLock(fdst);
|
||||
if (fdst->length) {
|
||||
|
Loading…
Reference in New Issue
Block a user