aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_plugin_transport_wlan_dummy.c
diff options
context:
space:
mode:
authorDavid Brodski <david@brodski.eu>2010-12-22 15:24:15 +0000
committerDavid Brodski <david@brodski.eu>2010-12-22 15:24:15 +0000
commit08f8355f7465824373f6c3150b0a750f1a27758b (patch)
tree82e8041da418143847a68e57264b92006ce4d96c /src/transport/test_plugin_transport_wlan_dummy.c
parent78c035a8492a5d57e0b16d6b784adbca2e817a96 (diff)
downloadgnunet-08f8355f7465824373f6c3150b0a750f1a27758b.tar.gz
gnunet-08f8355f7465824373f6c3150b0a750f1a27758b.zip
Errors fixed
Diffstat (limited to 'src/transport/test_plugin_transport_wlan_dummy.c')
-rw-r--r--src/transport/test_plugin_transport_wlan_dummy.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c
index 53b957eca..85ea223ab 100644
--- a/src/transport/test_plugin_transport_wlan_dummy.c
+++ b/src/transport/test_plugin_transport_wlan_dummy.c
@@ -50,6 +50,7 @@ void sigfunc(int sig)
50 else 50 else
51 { 51 {
52 closeprog = 1; 52 closeprog = 1;
53 exit(0);
53 } 54 }
54} 55}
55 56
@@ -58,26 +59,27 @@ void sigfunc(int sig)
58int 59int
59main(int argc, char *argv[]) 60main(int argc, char *argv[])
60{ 61{
61 struct stat st,st2; 62 struct stat st;
63 struct stat st2;
62 int erg; 64 int erg;
63 int first; 65 int first;
64 FILE *fpin; 66 FILE *fpin;
65 FILE *fpout; 67 FILE *fpout;
66 pid_t pid; 68 pid_t pid;
67 69
68 signal(SIGINT,sigfunc); 70 perror("Test");
69 signal(SIGTERM,sigfunc); 71
70 signal(SIGKILL,sigfunc);
71 72
72 //make the fifos if needed 73 //make the fifos if needed
73 if (stat(FIFO_FILE1, &st) != 0) 74 if (stat(FIFO_FILE1, &st) != 0)
74 { 75 {
75 if (stat(FIFO_FILE2, &st2) != 0) 76 if (stat(FIFO_FILE2, &st2) == 0)
76 { 77 {
77 perror("FIFO 2 exists, but FIFO 1 not"); 78 perror("FIFO 2 exists, but FIFO 1 not, blub");
78 exit(1); 79 exit(1);
79 } 80 }
80 first = 1; 81 first = 1;
82 perror("First");
81 umask(0); 83 umask(0);
82 erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0); 84 erg = mknod(FIFO_FILE1, S_IFIFO | 0666, 0);
83 erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0); 85 erg = mknod(FIFO_FILE2, S_IFIFO | 0666, 0);
@@ -96,9 +98,10 @@ main(int argc, char *argv[])
96 else 98 else
97 { 99 {
98 first = 0; 100 first = 0;
99 if (stat(FIFO_FILE2, &st2) == 0) 101 perror("Second");
102 if (stat(FIFO_FILE2, &st2) != 0)
100 { 103 {
101 perror("FIFO 1 exists, but FIFO 2 not"); 104 perror("FIFO 1 exists, but FIFO 2 not, mäh");
102 exit(1); 105 exit(1);
103 } 106 }
104 if ((fpout = fopen(FIFO_FILE1, "w")) == NULL) 107 if ((fpout = fopen(FIFO_FILE1, "w")) == NULL)
@@ -132,6 +135,10 @@ main(int argc, char *argv[])
132 } 135 }
133 else if (pid == 0) // CHILD PROCESS 136 else if (pid == 0) // CHILD PROCESS
134 { 137 {
138 perror("Child");
139 signal(SIGINT, sigfunc);
140 signal(SIGTERM, sigfunc);
141 signal(SIGKILL, sigfunc);
135 int rv = 0; 142 int rv = 0;
136 int readc = 0; 143 int readc = 0;
137 int pos = 0; 144 int pos = 0;
@@ -151,9 +158,9 @@ main(int argc, char *argv[])
151 158
152 pos = 0; 159 pos = 0;
153 160
154 fwrite(&line[pos], 1, sizeof(struct GNUNET_MessageHeader), fpout); 161 //fwrite(&line[pos], 1, sizeof(struct GNUNET_MessageHeader), fpout);
155 162
156 pos += sizeof(struct GNUNET_MessageHeader); 163 //pos += sizeof(struct GNUNET_MessageHeader);
157 164
158 //do not send radiotap header 165 //do not send radiotap header
159 pos += sizeof( struct RadiotapHeader); 166 pos += sizeof( struct RadiotapHeader);
@@ -170,6 +177,10 @@ main(int argc, char *argv[])
170 } 177 }
171 else // PARENT PROCESS 178 else // PARENT PROCESS
172 { 179 {
180 perror("Parent");
181 signal(SIGINT, sigfunc);
182 signal(SIGTERM, sigfunc);
183 signal(SIGKILL, sigfunc);
173 int rv = 0; 184 int rv = 0;
174 ssize_t pos = 0; 185 ssize_t pos = 0;
175 char line[MAXLINE]; 186 char line[MAXLINE];
@@ -186,11 +197,12 @@ main(int argc, char *argv[])
186 macmsg.hdr.size = sizeof(struct Wlan_Helper_Control_Message); 197 macmsg.hdr.size = sizeof(struct Wlan_Helper_Control_Message);
187 198
188 pos = 0; 199 pos = 0;
200 /*
189 while (pos < sizeof(struct Wlan_Helper_Control_Message)) 201 while (pos < sizeof(struct Wlan_Helper_Control_Message))
190 { 202 {
191 pos += write(STDOUT_FILENO, &macmsg + pos, sizeof(struct Wlan_Helper_Control_Message) - pos); 203 pos += write(STDOUT_FILENO, &macmsg + pos, sizeof(struct Wlan_Helper_Control_Message) - pos);
192 } 204 }
193 205 */
194 while (closeprog == 0) 206 while (closeprog == 0)
195 { 207 {
196 if ((rv = fread(line, 1, MAXLINE, fpin)) < 0) 208 if ((rv = fread(line, 1, MAXLINE, fpin)) < 0)