summaryrefslogtreecommitdiffstats
path: root/plugins/check_swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r--plugins/check_swap.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index ef60ce1b..94f41a55 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -166,11 +166,6 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
166 swap_config_wrapper conf_wrapper = {.errorcode = OK}; 166 swap_config_wrapper conf_wrapper = {.errorcode = OK};
167 conf_wrapper.config = swap_config_init(); 167 conf_wrapper.config = swap_config_init();
168 168
169 if (argc < 2) {
170 conf_wrapper.errorcode = ERROR;
171 return conf_wrapper;
172 }
173
174 static struct option longopts[] = {{"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'}, 169 static struct option longopts[] = {{"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'},
175 {"allswaps", no_argument, 0, 'a'}, {"no-swap", required_argument, 0, 'n'}, 170 {"allswaps", no_argument, 0, 'a'}, {"no-swap", required_argument, 0, 'n'},
176 {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, 171 {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'},
@@ -195,6 +190,7 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
195 */ 190 */
196 size_t length; 191 size_t length;
197 length = strlen(optarg); 192 length = strlen(optarg);
193 conf_wrapper.config.warn.is_set = true;
198 194
199 if (optarg[length - 1] == '%') { 195 if (optarg[length - 1] == '%') {
200 /* It's percentage */ 196 /* It's percentage */
@@ -224,6 +220,7 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
224 */ 220 */
225 size_t length; 221 size_t length;
226 length = strlen(optarg); 222 length = strlen(optarg);
223 conf_wrapper.config.crit.is_set = true;
227 224
228 if (optarg[length - 1] == '%') { 225 if (optarg[length - 1] == '%') {
229 /* It's percentage */ 226 /* It's percentage */
@@ -266,10 +263,6 @@ swap_config_wrapper process_arguments(int argc, char **argv) {
266 } 263 }
267 } 264 }
268 265
269 if (conf_wrapper.config.warn.value == 0 && conf_wrapper.config.crit.value == 0) {
270 conf_wrapper.errorcode = ERROR;
271 return conf_wrapper;
272 }
273 if ((conf_wrapper.config.warn.is_percentage == conf_wrapper.config.crit.is_percentage) && 266 if ((conf_wrapper.config.warn.is_percentage == conf_wrapper.config.crit.is_percentage) &&
274 (conf_wrapper.config.warn.value < conf_wrapper.config.crit.value)) { 267 (conf_wrapper.config.warn.value < conf_wrapper.config.crit.value)) {
275 /* This is NOT triggered if warn and crit are different units, e.g warn 268 /* This is NOT triggered if warn and crit are different units, e.g warn