]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - reg.c
iw: fix "iw reg get" double output
[thirdparty/iw.git] / reg.c
diff --git a/reg.c b/reg.c
index 1dca13a35d50294f2c0c57eea13d48ed780332cb..cee0b5e8cedbe09d1908965e8426f5f6c58b33db 100644 (file)
--- a/reg.c
+++ b/reg.c
@@ -244,14 +244,14 @@ static int handle_reg_get(struct nl80211_state *state,
        int err;
 
        err = handle_cmd(state, CIB_NONE, 2, dump_args);
-       /* dump might fail since it's not supported on older kernels */
-       if (err == -EOPNOTSUPP) {
-               register_handler(print_reg_handler,
-                         NULL);
+       /*
+        * dump might fail since it's not supported on older kernels,
+        * in that case the handler is still registered already
+        */
+       if (err == -EOPNOTSUPP)
                return 0;
-       }
 
-       return err;
+       return err ?: HANDLER_RET_DONE;
 }
 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get,
        "Print out the kernel's current regulatory domain information.");