From 925ad7400aa05e49ed3673f22f01581195501f6e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 13 Jul 2016 02:55:46 +0200 Subject: Priority is not used when removing filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/server.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/server.c b/src/server.c index 4b1f939..16a9dcf 100644 --- a/src/server.c +++ b/src/server.c @@ -660,13 +660,12 @@ static int set_gamma(size_t conn, char* crtc, char* priority, char* class, char* ssize_t r; if ((crtc == NULL) || - (priority == NULL) || (class == NULL) || (lifespan == NULL)) return fprintf(stderr, "%s: ignoring incomplete Command: set-gamma message\n", argv0), 0; filter.client = connections[conn]; - filter.priority = (int64_t)atoll(priority); + filter.priority = priority == NULL ? 0 : (int64_t)atoll(priority); filter.ramps = NULL; output = output_find_by_name(crtc, outputs, outputs_n); @@ -696,12 +695,17 @@ static int set_gamma(size_t conn, char* crtc, char* priority, char* class, char* if (filter.lifespan == LIFESPAN_REMOVE) { if (msg->payload_size) - fprintf(stderr, "%s: ignoring superfluous playload on Command: set-gamma message with " + fprintf(stderr, "%s: ignoring superfluous payload on Command: set-gamma message with " + "Lifespan: remove\n", argv0); + if (priority != NULL) + fprintf(stderr, "%s: ignoring superfluous Priority header on Command: set-gamma message with " "Lifespan: remove\n", argv0); } else if (msg->payload_size != output->ramps_size) return fprintf(stderr, "%s: ignoring Command: set-gamma message bad payload: size: %zu instead of %zu\n", argv0, msg->payload_size, output->ramps_size), 0; + else if (priority == 0) + return fprintf(stderr, "%s: ignoring incomplete Command: set-gamma message\n", argv0), 0; filter.class = memdup(class, strlen(class) + 1); if (filter.class == NULL) -- cgit v1.2.3-70-g09d2