]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - vendor.c
iw: fix fp handling inside handle_vendor
[thirdparty/iw.git] / vendor.c
index 860cd48a2b7da0613d58f63b601e4ea32e55afc6..d203d8522d4fb24376b6ca86dafc8bf8d362113f 100644 (file)
--- a/vendor.c
+++ b/vendor.c
@@ -107,7 +107,8 @@ static int handle_vendor(struct nl80211_state *state,
 
        if (file) {
                count = read_file(file, buf, sizeof(buf));
-               fclose(file);
+               if (file != stdin)
+                       fclose(file);
        } else
                count = read_hex(argc - 2, &argv[2], buf, sizeof(buf));
 
@@ -120,6 +121,8 @@ static int handle_vendor(struct nl80211_state *state,
        return 0;
 
 nla_put_failure:
+       if (file && file != stdin)
+               fclose(file);
        return -ENOBUFS;
 }