Permalink
Browse files

Fixes #3072, Xft.dpi can be floating point

  • Loading branch information...
veselov committed Dec 9, 2017
1 parent 90dd84e commit d2b35388b4a4626f3c57f18a470bf1244eaee837
Showing with 3 additions and 2 deletions.
  1. +3 −2 libi3/dpi.c
View
@@ -43,12 +43,13 @@ void init_dpi(void) {
}
char *endptr;
dpi = strtol(resource, &endptr, 10);
if (dpi == LONG_MAX || dpi == LONG_MIN || dpi < 0 || *endptr != '\0' || endptr == resource) {
double in_dpi = strtod(resource, &endptr);
if (in_dpi == HUGE_VAL || dpi < 0 || *endptr != '\0' || endptr == resource) {
ELOG("Xft.dpi = %s is an invalid number and couldn't be parsed.\n", resource);
dpi = 0;
goto init_dpi_end;
}
dpi = (long)round(in_dpi);
DLOG("Found Xft.dpi = %ld.\n", dpi);

0 comments on commit d2b3538

Please sign in to comment.