diff options
author | Hans-Werner Hilse <hwhilse@gmail.com> | 2015-06-11 05:29:19 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-06-25 16:42:19 -0400 |
commit | f9bb3b5947c507d402eecbffabb8fb0864263ad1 (patch) | |
tree | 82e1167c87b395d3bcb2ef3cd1e73236d1cf9527 /arch | |
parent | 9a75551aeaa8c79fd6ad713cb20e6bbccc767331 (diff) |
um: Do not use stdin and stdout identifiers for struct members
stdin, stdout and stderr are macros according to C89/C99.
Thus do not use them as struct member identifiers to avoid
bad results from macro expansion.
Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/drivers/harddog_user.c | 18 | ||||
-rw-r--r-- | arch/um/drivers/net_user.c | 6 | ||||
-rw-r--r-- | arch/um/drivers/slip_user.c | 14 | ||||
-rw-r--r-- | arch/um/drivers/slirp_user.c | 16 | ||||
-rw-r--r-- | arch/um/os-Linux/drivers/tuntap_user.c | 6 |
5 files changed, 30 insertions, 30 deletions
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c index f99b32a4dbff..3aa8b0d52a48 100644 --- a/arch/um/drivers/harddog_user.c +++ b/arch/um/drivers/harddog_user.c | |||
@@ -9,8 +9,8 @@ | |||
9 | #include <os.h> | 9 | #include <os.h> |
10 | 10 | ||
11 | struct dog_data { | 11 | struct dog_data { |
12 | int stdin; | 12 | int stdin_fd; |
13 | int stdout; | 13 | int stdout_fd; |
14 | int close_me[2]; | 14 | int close_me[2]; |
15 | }; | 15 | }; |
16 | 16 | ||
@@ -18,11 +18,11 @@ static void pre_exec(void *d) | |||
18 | { | 18 | { |
19 | struct dog_data *data = d; | 19 | struct dog_data *data = d; |
20 | 20 | ||
21 | dup2(data->stdin, 0); | 21 | dup2(data->stdin_fd, 0); |
22 | dup2(data->stdout, 1); | 22 | dup2(data->stdout_fd, 1); |
23 | dup2(data->stdout, 2); | 23 | dup2(data->stdout_fd, 2); |
24 | close(data->stdin); | 24 | close(data->stdin_fd); |
25 | close(data->stdout); | 25 | close(data->stdout_fd); |
26 | close(data->close_me[0]); | 26 | close(data->close_me[0]); |
27 | close(data->close_me[1]); | 27 | close(data->close_me[1]); |
28 | } | 28 | } |
@@ -49,8 +49,8 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock) | |||
49 | goto out_close_in; | 49 | goto out_close_in; |
50 | } | 50 | } |
51 | 51 | ||
52 | data.stdin = out_fds[0]; | 52 | data.stdin_fd = out_fds[0]; |
53 | data.stdout = in_fds[1]; | 53 | data.stdout_fd = in_fds[1]; |
54 | data.close_me[0] = out_fds[1]; | 54 | data.close_me[0] = out_fds[1]; |
55 | data.close_me[1] = in_fds[0]; | 55 | data.close_me[1] = in_fds[0]; |
56 | 56 | ||
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c index cd14157b556d..e697a4136707 100644 --- a/arch/um/drivers/net_user.c +++ b/arch/um/drivers/net_user.c | |||
@@ -166,7 +166,7 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len) | |||
166 | 166 | ||
167 | struct change_pre_exec_data { | 167 | struct change_pre_exec_data { |
168 | int close_me; | 168 | int close_me; |
169 | int stdout; | 169 | int stdout_fd; |
170 | }; | 170 | }; |
171 | 171 | ||
172 | static void change_pre_exec(void *arg) | 172 | static void change_pre_exec(void *arg) |
@@ -174,7 +174,7 @@ static void change_pre_exec(void *arg) | |||
174 | struct change_pre_exec_data *data = arg; | 174 | struct change_pre_exec_data *data = arg; |
175 | 175 | ||
176 | close(data->close_me); | 176 | close(data->close_me); |
177 | dup2(data->stdout, 1); | 177 | dup2(data->stdout_fd, 1); |
178 | } | 178 | } |
179 | 179 | ||
180 | static int change_tramp(char **argv, char *output, int output_len) | 180 | static int change_tramp(char **argv, char *output, int output_len) |
@@ -189,7 +189,7 @@ static int change_tramp(char **argv, char *output, int output_len) | |||
189 | return err; | 189 | return err; |
190 | } | 190 | } |
191 | pe_data.close_me = fds[0]; | 191 | pe_data.close_me = fds[0]; |
192 | pe_data.stdout = fds[1]; | 192 | pe_data.stdout_fd = fds[1]; |
193 | pid = run_helper(change_pre_exec, &pe_data, argv); | 193 | pid = run_helper(change_pre_exec, &pe_data, argv); |
194 | 194 | ||
195 | if (pid > 0) /* Avoid hang as we won't get data in failure case. */ | 195 | if (pid > 0) /* Avoid hang as we won't get data in failure case. */ |
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c index 55c290d925f3..0d6b66c64a81 100644 --- a/arch/um/drivers/slip_user.c +++ b/arch/um/drivers/slip_user.c | |||
@@ -55,8 +55,8 @@ static int set_up_tty(int fd) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | struct slip_pre_exec_data { | 57 | struct slip_pre_exec_data { |
58 | int stdin; | 58 | int stdin_fd; |
59 | int stdout; | 59 | int stdout_fd; |
60 | int close_me; | 60 | int close_me; |
61 | }; | 61 | }; |
62 | 62 | ||
@@ -64,9 +64,9 @@ static void slip_pre_exec(void *arg) | |||
64 | { | 64 | { |
65 | struct slip_pre_exec_data *data = arg; | 65 | struct slip_pre_exec_data *data = arg; |
66 | 66 | ||
67 | if (data->stdin >= 0) | 67 | if (data->stdin_fd >= 0) |
68 | dup2(data->stdin, 0); | 68 | dup2(data->stdin_fd, 0); |
69 | dup2(data->stdout, 1); | 69 | dup2(data->stdout_fd, 1); |
70 | if (data->close_me >= 0) | 70 | if (data->close_me >= 0) |
71 | close(data->close_me); | 71 | close(data->close_me); |
72 | } | 72 | } |
@@ -85,8 +85,8 @@ static int slip_tramp(char **argv, int fd) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | err = 0; | 87 | err = 0; |
88 | pe_data.stdin = fd; | 88 | pe_data.stdin_fd = fd; |
89 | pe_data.stdout = fds[1]; | 89 | pe_data.stdout_fd = fds[1]; |
90 | pe_data.close_me = fds[0]; | 90 | pe_data.close_me = fds[0]; |
91 | err = run_helper(slip_pre_exec, &pe_data, argv); | 91 | err = run_helper(slip_pre_exec, &pe_data, argv); |
92 | if (err < 0) | 92 | if (err < 0) |
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c index c999d187abb9..98b6a41a254e 100644 --- a/arch/um/drivers/slirp_user.c +++ b/arch/um/drivers/slirp_user.c | |||
@@ -20,18 +20,18 @@ static int slirp_user_init(void *data, void *dev) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | struct slirp_pre_exec_data { | 22 | struct slirp_pre_exec_data { |
23 | int stdin; | 23 | int stdin_fd; |
24 | int stdout; | 24 | int stdout_fd; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static void slirp_pre_exec(void *arg) | 27 | static void slirp_pre_exec(void *arg) |
28 | { | 28 | { |
29 | struct slirp_pre_exec_data *data = arg; | 29 | struct slirp_pre_exec_data *data = arg; |
30 | 30 | ||
31 | if (data->stdin != -1) | 31 | if (data->stdin_fd != -1) |
32 | dup2(data->stdin, 0); | 32 | dup2(data->stdin_fd, 0); |
33 | if (data->stdout != -1) | 33 | if (data->stdout_fd != -1) |
34 | dup2(data->stdout, 1); | 34 | dup2(data->stdout_fd, 1); |
35 | } | 35 | } |
36 | 36 | ||
37 | static int slirp_tramp(char **argv, int fd) | 37 | static int slirp_tramp(char **argv, int fd) |
@@ -39,8 +39,8 @@ static int slirp_tramp(char **argv, int fd) | |||
39 | struct slirp_pre_exec_data pe_data; | 39 | struct slirp_pre_exec_data pe_data; |
40 | int pid; | 40 | int pid; |
41 | 41 | ||
42 | pe_data.stdin = fd; | 42 | pe_data.stdin_fd = fd; |
43 | pe_data.stdout = fd; | 43 | pe_data.stdout_fd = fd; |
44 | pid = run_helper(slirp_pre_exec, &pe_data, argv); | 44 | pid = run_helper(slirp_pre_exec, &pe_data, argv); |
45 | 45 | ||
46 | return pid; | 46 | return pid; |
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c index 14126d9176aa..c2e6e1dad876 100644 --- a/arch/um/os-Linux/drivers/tuntap_user.c +++ b/arch/um/os-Linux/drivers/tuntap_user.c | |||
@@ -47,7 +47,7 @@ static void tuntap_del_addr(unsigned char *addr, unsigned char *netmask, | |||
47 | } | 47 | } |
48 | 48 | ||
49 | struct tuntap_pre_exec_data { | 49 | struct tuntap_pre_exec_data { |
50 | int stdout; | 50 | int stdout_fd; |
51 | int close_me; | 51 | int close_me; |
52 | }; | 52 | }; |
53 | 53 | ||
@@ -55,7 +55,7 @@ static void tuntap_pre_exec(void *arg) | |||
55 | { | 55 | { |
56 | struct tuntap_pre_exec_data *data = arg; | 56 | struct tuntap_pre_exec_data *data = arg; |
57 | 57 | ||
58 | dup2(data->stdout, 1); | 58 | dup2(data->stdout_fd, 1); |
59 | close(data->close_me); | 59 | close(data->close_me); |
60 | } | 60 | } |
61 | 61 | ||
@@ -74,7 +74,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote, | |||
74 | 74 | ||
75 | sprintf(version_buf, "%d", UML_NET_VERSION); | 75 | sprintf(version_buf, "%d", UML_NET_VERSION); |
76 | 76 | ||
77 | data.stdout = remote; | 77 | data.stdout_fd = remote; |
78 | data.close_me = me; | 78 | data.close_me = me; |
79 | 79 | ||
80 | pid = run_helper(tuntap_pre_exec, &data, argv); | 80 | pid = run_helper(tuntap_pre_exec, &data, argv); |