diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-12-01 14:48:11 +0100 | 
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-12-01 14:48:11 +0100 | 
| commit | 306ee610d24a274f7e765898fbd760d274549388 (patch) | |
| tree | 13ba58600e51a8464ba5748963e892a3a265c13d /src | |
| parent | Check that the value of -p is proper (diff) | |
| download | cg-tools-306ee610d24a274f7e765898fbd760d274549388.tar.gz cg-tools-306ee610d24a274f7e765898fbd760d274549388.tar.bz2 cg-tools-306ee610d24a274f7e765898fbd760d274549388.tar.xz | |
Fix bugs
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
| -rw-r--r-- | src/cg-base.c | 2 | ||||
| -rw-r--r-- | src/cg-brilliance.c | 2 | ||||
| -rw-r--r-- | src/cg-darkroom.c | 2 | ||||
| -rw-r--r-- | src/cg-gamma.c | 2 | ||||
| -rw-r--r-- | src/cg-limits.c | 2 | ||||
| -rw-r--r-- | src/cg-rainbow.c | 4 | ||||
| -rw-r--r-- | src/cg-sleepmode.c | 2 | 
7 files changed, 8 insertions, 8 deletions
| diff --git a/src/cg-base.c b/src/cg-base.c index d9da32a..1309ded 100644 --- a/src/cg-base.c +++ b/src/cg-base.c @@ -657,7 +657,7 @@ int main(int argc, char* argv[])        char *end;        errno = 0;        priority = (int64_t)strtoll(prio, &end, 10); -      if (errno || *end) +      if (errno || *end || !*prio)  	usage();      } diff --git a/src/cg-brilliance.c b/src/cg-brilliance.c index 1ad590d..eab9806 100644 --- a/src/cg-brilliance.c +++ b/src/cg-brilliance.c @@ -132,7 +132,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("0123456789.", *str)) +  if (!*str || !strchr("0123456789.", *str))      return -1;    return 0;  } diff --git a/src/cg-darkroom.c b/src/cg-darkroom.c index 03222a7..8d7d7fd 100644 --- a/src/cg-darkroom.c +++ b/src/cg-darkroom.c @@ -122,7 +122,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("0123456789.", *str)) +  if (!*str || !strchr("0123456789.", *str))      return -1;    return 0;  } diff --git a/src/cg-gamma.c b/src/cg-gamma.c index b72cd21..d44b761 100644 --- a/src/cg-gamma.c +++ b/src/cg-gamma.c @@ -217,7 +217,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("0123456789.", *str)) +  if (!*str || !strchr("0123456789.", *str))      return -1;    return 0;  } diff --git a/src/cg-limits.c b/src/cg-limits.c index 78f0b6c..3f057bd 100644 --- a/src/cg-limits.c +++ b/src/cg-limits.c @@ -276,7 +276,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("-0123456789.", *str)) +  if (!*str || !strchr("-0123456789.", *str))      return -1;    return 0;  } diff --git a/src/cg-rainbow.c b/src/cg-rainbow.c index 8aaa2cb..6ef606e 100644 --- a/src/cg-rainbow.c +++ b/src/cg-rainbow.c @@ -70,7 +70,7 @@ double luminosity = (double)1 / 3;  void usage(void)  {    fprintf(stderr, -	  "Usage: %s [-M method] [-S site] [-c crtc]... [-R rule] [-p priority] " +	  "Usage: %s [-M method] [-S site] [-c crtc]... [-R rule] [-p priority]"  	  " [-l luminosity] [-s rainbowhz]\n",  	  argv0);    exit(1); @@ -127,7 +127,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("0123456789.", *str)) +  if (!*str || !strchr("0123456789.", *str))      return -1;    return 0;  } diff --git a/src/cg-sleepmode.c b/src/cg-sleepmode.c index 42fea0d..c4a41e6 100644 --- a/src/cg-sleepmode.c +++ b/src/cg-sleepmode.c @@ -178,7 +178,7 @@ static int parse_double(double* restrict out, const char* restrict str)    *out = strtod(str, &end);    if (errno || (*out < 0) || isinf(*out) || isnan(*out) || *end)      return -1; -  if (!strchr("0123456789.", *str)) +  if (!*str || !strchr("0123456789.", *str))      return -1;    return 0;  } | 
