mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +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; \
|
goto label; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
# define virCheckPositiveArgReturn(argname, retval) \
|
||||||
|
do { \
|
||||||
|
if (argname <= 0) { \
|
||||||
|
virReportInvalidPositiveArg(argname); \
|
||||||
|
return retval; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
# define virCheckNonZeroArgGoto(argname, label) \
|
# define virCheckNonZeroArgGoto(argname, label) \
|
||||||
do { \
|
do { \
|
||||||
if (argname == 0) { \
|
if (argname == 0) { \
|
||||||
|
@ -367,6 +367,7 @@ virNetClientStreamSetHole(virNetClientStreamPtr st,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
virCheckPositiveArgReturn(length, -1);
|
||||||
|
|
||||||
/* Shouldn't happen, But it's better to safe than sorry. */
|
/* Shouldn't happen, But it's better to safe than sorry. */
|
||||||
if (st->holeLength) {
|
if (st->holeLength) {
|
||||||
|
@ -950,6 +950,7 @@ virFDStreamSendHole(virStreamPtr st,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
virCheckPositiveArgReturn(length, -1);
|
||||||
|
|
||||||
virObjectLock(fdst);
|
virObjectLock(fdst);
|
||||||
if (fdst->length) {
|
if (fdst->length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user