diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2009-09-12 14:03:42 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2009-09-12 14:03:42 (GMT) |
commit | 5f958b3bd5c33282ab5b772854d96d4d2a6b72e6 (patch) | |
tree | 6db32d5e544fd0b668e623593049e45ec2d31c2c /src | |
parent | 6a37a047eb6dab60b914ac8177a5c4f73f1a108f (diff) | |
download | fluxbox_lack-5f958b3bd5c33282ab5b772854d96d4d2a6b72e6.zip fluxbox_lack-5f958b3bd5c33282ab5b772854d96d4d2a6b72e6.tar.bz2 |
check for errno while parsing the deco mask
Diffstat (limited to 'src')
-rw-r--r-- | src/WindowState.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/WindowState.cc b/src/WindowState.cc index 50a88fc..1b8647a 100644 --- a/src/WindowState.cc +++ b/src/WindowState.cc | |||
@@ -23,7 +23,8 @@ | |||
23 | 23 | ||
24 | #include "FbTk/StringUtil.hh" | 24 | #include "FbTk/StringUtil.hh" |
25 | 25 | ||
26 | #include <stdlib.h> | 26 | #include <cstdlib> |
27 | #include <errno.h> | ||
27 | 28 | ||
28 | bool WindowState::useBorder() const { | 29 | bool WindowState::useBorder() const { |
29 | return !fullscreen && maximized != MAX_FULL && deco_mask & DECORM_BORDER; | 30 | return !fullscreen && maximized != MAX_FULL && deco_mask & DECORM_BORDER; |
@@ -92,10 +93,14 @@ int WindowState::getDecoMaskFromString(const std::string &str_label) { | |||
92 | return DECOR_BORDER; | 93 | return DECOR_BORDER; |
93 | if (label == "tab") | 94 | if (label == "tab") |
94 | return DECOR_TAB; | 95 | return DECOR_TAB; |
96 | |||
95 | int mask = -1; | 97 | int mask = -1; |
96 | if ((str_label.size() > 1 && str_label[0] == '0' && str_label[1] == 'x') || | 98 | int tmp; |
97 | (str_label.size() > 0 && isdigit(str_label[0]))) | 99 | errno = 0; |
98 | mask = strtol(str_label.c_str(), NULL, 0); | 100 | tmp = strtol(str_label.c_str(), NULL, 0); |
101 | if (errno == 0) | ||
102 | mask = tmp; | ||
103 | |||
99 | return mask; | 104 | return mask; |
100 | } | 105 | } |
101 | 106 | ||