OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 14... | Line 14... | |||
14 | */ |
14 | */ |
|
Line 15... | Line 15... | |||
15 | |
15 | |
|
16 | #include <stdio.h> |
16 | #include <stdio.h> |
|
17 | #include <string.h> |
17 | #include <string.h> |
|
18 | #include <stdlib.h> |
- | ||
19 | #include <ctype.h> |
18 | #include <stdlib.h> |
|
20 | #include <inttypes.h> |
19 | #include <inttypes.h> |
|
21 | #include <errno.h> |
20 | #include <errno.h> |
|
22 | #include <stdint.h> |
21 | #include <stdint.h> |
|
23 | #include <getopt.h> |
22 | #include <getopt.h> |
|
Line 91... | Line 90... | |||
91 | { |
90 | { |
|
92 | struct nl_msg *msg; |
91 | struct nl_msg *msg; |
|
93 | struct nl_cb *cb = NULL; |
92 | struct nl_cb *cb = NULL; |
|
94 | int finished; |
93 | int finished; |
|
95 | int flags = 0; |
94 | int flags = 0; |
|
96 | int err = 0; |
95 | int err; |
|
Line 97... | Line 96... | |||
97 | |
96 | |
|
98 | msg = nlmsg_alloc(); |
97 | msg = nlmsg_alloc(); |
|
99 | if (!msg) { |
98 | if (!msg) { |
|
100 | fprintf(stderr, "Out of memory!\n"); |
99 | fprintf(stderr, "Out of memory!\n"); |
|
Line 104... | Line 103... | |||
104 | if (!data) |
103 | if (!data) |
|
105 | flags |= NLM_F_DUMP; |
104 | flags |= NLM_F_DUMP; |
|
Line 106... | Line 105... | |||
106 | |
105 | |
|
107 | genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, genl_family_get_id(family), 0, flags, cmd, 0); |
106 | genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, genl_family_get_id(family), 0, flags, cmd, 0); |
|
108 | if (data) { |
107 | if (data) { |
|
109 | err = data(msg, arg); |
- | ||
110 | if (err < 0) |
108 | if (data(msg, arg) < 0) |
|
111 | goto nla_put_failure; |
109 | goto nla_put_failure; |
|
Line 112... | Line 110... | |||
112 | } |
110 | } |
|
113 | |
111 | |