diff options
author | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2010-10-09 23:11:26 +0530 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2010-10-15 01:10:00 +0530 |
commit | 3265424f271f15f334a299cc10086c0b9be34979 (patch) | |
tree | 62285338264180b4d49a2bbb857e3e534f7117e6 | |
parent | 0edbb2c6aa28faf564d2929318ab21c872335f04 (diff) |
pactl: Validate volume before setting
This makes sure that a valid volume is provided before setting on
sink/sink-input/source.
-rw-r--r-- | src/utils/pactl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/pactl.c b/src/utils/pactl.c index cae96f29..98c4d455 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -1248,6 +1248,11 @@ int main(int argc, char *argv[]) { goto quit; } + if (!PA_VOLUME_IS_VALID(v)) { + pa_log(_("Volume outside permissible range.\n")); + goto quit; + } + sink_name = pa_xstrdup(argv[optind+1]); volume = (pa_volume_t) v; @@ -1265,6 +1270,11 @@ int main(int argc, char *argv[]) { goto quit; } + if (!PA_VOLUME_IS_VALID(v)) { + pa_log(_("Volume outside permissible range.\n")); + goto quit; + } + source_name = pa_xstrdup(argv[optind+1]); volume = (pa_volume_t) v; @@ -1287,6 +1297,11 @@ int main(int argc, char *argv[]) { goto quit; } + if (!PA_VOLUME_IS_VALID(v)) { + pa_log(_("Volume outside permissible range.\n")); + goto quit; + } + volume = (pa_volume_t) v; } else if (pa_streq(argv[optind], "set-sink-mute")) { |