diff options
author | David Brodski <david@brodski.eu> | 2010-12-22 12:53:41 +0000 |
---|---|---|
committer | David Brodski <david@brodski.eu> | 2010-12-22 12:53:41 +0000 |
commit | 7c1bbd6fd987b8ef8c0fbd5319279878430cf2c5 (patch) | |
tree | f3bd2c246fcaacfd64bb108076e677b22470d738 /src/transport/test_plugin_transport_wlan_dummy.c | |
parent | 7d3268171b3ff537dd0e06600d7e009ce23a7afe (diff) | |
download | gnunet-7c1bbd6fd987b8ef8c0fbd5319279878430cf2c5.tar.gz gnunet-7c1bbd6fd987b8ef8c0fbd5319279878430cf2c5.zip |
Errors fixed
Diffstat (limited to 'src/transport/test_plugin_transport_wlan_dummy.c')
-rw-r--r-- | src/transport/test_plugin_transport_wlan_dummy.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c index db50bd125..b4fd46610 100644 --- a/src/transport/test_plugin_transport_wlan_dummy.c +++ b/src/transport/test_plugin_transport_wlan_dummy.c | |||
@@ -119,6 +119,15 @@ main(int argc, char *argv[]) | |||
119 | if ((pid = fork()) < 0) | 119 | if ((pid = fork()) < 0) |
120 | { | 120 | { |
121 | perror("FORK ERROR"); | 121 | perror("FORK ERROR"); |
122 | |||
123 | //clean up | ||
124 | if (first == 1) | ||
125 | { | ||
126 | unlink(FIFO_FILE1); | ||
127 | unlink(FIFO_FILE2); | ||
128 | } | ||
129 | fclose(fpin); | ||
130 | fclose(fpout); | ||
122 | return -3; | 131 | return -3; |
123 | } | 132 | } |
124 | else if (pid == 0) // CHILD PROCESS | 133 | else if (pid == 0) // CHILD PROCESS |
@@ -164,12 +173,29 @@ main(int argc, char *argv[]) | |||
164 | int rv = 0; | 173 | int rv = 0; |
165 | ssize_t pos = 0; | 174 | ssize_t pos = 0; |
166 | char line[MAXLINE]; | 175 | char line[MAXLINE]; |
176 | struct Wlan_Helper_Control_Message macmsg; | ||
177 | |||
178 | |||
179 | //Send random mac address | ||
180 | macmsg.mac.mac[0] = 0x13; | ||
181 | macmsg.mac.mac[1] = 0x22; | ||
182 | macmsg.mac.mac[2] = 0x33; | ||
183 | macmsg.mac.mac[3] = 0x44; | ||
184 | macmsg.mac.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 255); | ||
185 | macmsg.mac.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 255); | ||
186 | macmsg.hdr.size = sizeof(struct Wlan_Helper_Control_Message); | ||
187 | |||
188 | pos = 0; | ||
189 | while (pos < sizeof(struct Wlan_Helper_Control_Message)) | ||
190 | { | ||
191 | pos += write(STDOUT_FILENO, &macmsg + pos, sizeof(struct Wlan_Helper_Control_Message) - pos); | ||
192 | } | ||
167 | 193 | ||
168 | while (closeprog == 0) | 194 | while (closeprog == 0) |
169 | { | 195 | { |
170 | if ((rv = fread(line, 1, MAXLINE, fpin)) < 0) | 196 | if ((rv = fread(line, 1, MAXLINE, fpin)) < 0) |
171 | { | 197 | { |
172 | perror("READ ERROR FROM STDIN"); | 198 | perror("READ ERROR FROM fpin"); |
173 | } | 199 | } |
174 | 200 | ||
175 | pos = 0; | 201 | pos = 0; |