diff options
Diffstat (limited to 'xbacklight.c')
-rw-r--r-- | xbacklight.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xbacklight.c b/xbacklight.c index b7c8011..64a043d 100644 --- a/xbacklight.c +++ b/xbacklight.c @@ -64,9 +64,13 @@ static double atof_or_die (char *str) { double retval; + char *endptr = NULL; errno = 0; - retval = strtod(str, NULL); - if (errno) usage(1); + retval = strtod(str, &endptr); + if ((errno != 0) || (endptr == str)) { + fprintf(stderr, "%s: invalid argument '%s'\n", program_name, str); + usage(1); + } return retval; } |