summaryrefslogtreecommitdiff
path: root/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp')
-rw-r--r--src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
index 6e708f9c..2765372b 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -107,6 +107,12 @@ static RTEXITCODE handleBandwidthControlAdd(HandlerArg *a, ComPtr<IBandwidthCont
Bstr name(a->argv[2]);
+ if (name.isEmpty())
+ {
+ errorArgument("Bandwidth group name must not be empty!\n");
+ return RTEXITCODE_FAILURE;
+ }
+
const char *pszType = NULL;
int64_t cMaxBytesPerSec = INT64_MAX;
@@ -166,7 +172,7 @@ static RTEXITCODE handleBandwidthControlAdd(HandlerArg *a, ComPtr<IBandwidthCont
errorArgument("Invalid bandwidth group type\n");
return RTEXITCODE_FAILURE;
}
-
+
CHECK_ERROR2_RET(bwCtrl, CreateBandwidthGroup(name.raw(), enmType, (LONG64)cMaxBytesPerSec), RTEXITCODE_FAILURE);
return RTEXITCODE_SUCCESS;
@@ -226,7 +232,7 @@ static RTEXITCODE handleBandwidthControlSet(HandlerArg *a, ComPtr<IBandwidthCont
}
}
-
+
if (cMaxBytesPerSec != INT64_MAX)
{
ComPtr<IBandwidthGroup> bwGroup;
@@ -274,8 +280,11 @@ static RTEXITCODE handleBandwidthControlList(HandlerArg *pArgs, ComPtr<IBandwidt
{
switch (c)
{
- case 'M': enmDetails = VMINFO_MACHINEREADABLE; break;
- default: return errorGetOpt(USAGE_BANDWIDTHCONTROL, c, &ValueUnion);
+ case 'M':
+ enmDetails = VMINFO_MACHINEREADABLE;
+ break;
+ default:
+ return errorGetOpt(USAGE_BANDWIDTHCONTROL, c, &ValueUnion);
}
}