summaryrefslogtreecommitdiff
path: root/xrandr.c
diff options
context:
space:
mode:
authorÉric Piel <eric.piel@tremplin-utc.net>2009-10-26 14:11:02 +0100
committerMatthias Hopf <mhopf@suse.de>2009-11-10 09:58:41 +0100
commitb84560759141ed52b8779c184184f888e9be8b2f (patch)
tree746c97d861221a3cbfde16f4a5e88845425fad4f /xrandr.c
parent34829957441a10f6b6e31141aa1018f7a72aeaf9 (diff)
xrandr: do not segfault when "--scale" or "--transform" have no output
"xrandr --scale 2x2" segfaults, because the --scale (and --transform) options do not check for an existing output. Make sure there is an output specified (like every other options). Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net> Signed-off-by: Matthias Hopf <mhopf@suse.de>
Diffstat (limited to 'xrandr.c')
-rw-r--r--xrandr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xrandr.c b/xrandr.c
index 2d61978..eb23784 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2157,7 +2157,6 @@ main (int argc, char **argv)
if (++i>=argc) usage ();
screen = check_strtol(argv[i]);
if (screen < 0) usage();
- action_requested = True;
continue;
}
if (!strcmp ("-q", argv[i]) || !strcmp ("--query", argv[i])) {
@@ -2368,6 +2367,7 @@ main (int argc, char **argv)
if (!strcmp ("--scale", argv[i]))
{
double sx, sy;
+ if (!output) usage();
if (++i>=argc) usage();
if (sscanf (argv[i], "%lfx%lf", &sx, &sy) != 2)
usage ();
@@ -2387,6 +2387,7 @@ main (int argc, char **argv)
if (!strcmp ("--transform", argv[i])) {
double transform[3][3];
int k, l;
+ if (!output) usage();
if (++i>=argc) usage ();
init_transform (&output->transform);
if (strcmp (argv[i], "none") != 0)