diff options
Diffstat (limited to 'util-linux/fbset.c')
-rw-r--r-- | util-linux/fbset.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index f67a283c1..d616abd36 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
@@ -181,10 +181,11 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
181 | f = xfopen(fn, "r"); | 181 | f = xfopen(fn, "r"); |
182 | while (!feof(f)) { | 182 | while (!feof(f)) { |
183 | fgets(buf, sizeof(buf), f); | 183 | fgets(buf, sizeof(buf), f); |
184 | if (!(p = strstr(buf, "mode ")) && !(p = strstr(buf, "mode\t"))) | 184 | p = strstr(buf, "mode "); |
185 | if (!p && !(p = strstr(buf, "mode\t"))) | ||
185 | continue; | 186 | continue; |
186 | p += 5; | 187 | p = strstr(p + 5, mode); |
187 | if (!(p = strstr(buf, mode))) | 188 | if (!p) |
188 | continue; | 189 | continue; |
189 | p += strlen(mode); | 190 | p += strlen(mode); |
190 | if (!isspace(*p) && (*p != 0) && (*p != '"') | 191 | if (!isspace(*p) && (*p != 0) && (*p != '"') |
@@ -193,7 +194,8 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
193 | 194 | ||
194 | while (!feof(f)) { | 195 | while (!feof(f)) { |
195 | fgets(buf, sizeof(buf), f); | 196 | fgets(buf, sizeof(buf), f); |
196 | if ((p = strstr(buf, "geometry "))) { | 197 | p = strstr(buf, "geometry "); |
198 | if (p) { | ||
197 | p += 9; | 199 | p += 9; |
198 | /* FIXME: catastrophic on arches with 64bit ints */ | 200 | /* FIXME: catastrophic on arches with 64bit ints */ |
199 | sscanf(p, "%d %d %d %d %d", | 201 | sscanf(p, "%d %d %d %d %d", |