REST/NAMESTORE: rework API
[oweals/gnunet.git] / src / transport / gnunet-transport-wlan-receiver.c
index 73ca83ddc9603d1ae9c302bf7d18eccb80acf983..04f30a683a99387f07820aaf84ccb0c5da663065 100644 (file)
@@ -1,21 +1,21 @@
 /*
  This file is part of GNUnet
- (C) 2012 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2012 GNUnet e.V.
 
- GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
 
  GNUnet is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
Affero General Public License for more details.
 
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 
 /**
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
   /* Setup communication pipeline first */
   if (pipe (commpipe))
   {
-    fprintf (stderr, 
+    fprintf (stderr,
             "Failed to create pipe: %s\n",
             STRERROR (errno));
     exit (1);
@@ -62,8 +62,8 @@ main (int argc, char *argv[])
   /* Attempt to fork and check for errors */
   if ((pid = fork ()) == -1)
   {
-    fprintf (stderr, "Failed to fork: %s\n", 
-            STRERROR (errno));    
+    fprintf (stderr, "Failed to fork: %s\n",
+            STRERROR (errno));
     exit (1);
   }
 
@@ -78,16 +78,19 @@ main (int argc, char *argv[])
     count = 0;
     while (1)
     {
-      ret = read (commpipe[1], msg_buf, sizeof (msg_buf));
+      ret = read (commpipe[0], msg_buf, sizeof (msg_buf));
       if (0 > ret)
+      {
+       fprintf (stderr, "read failed: %s\n", strerror (errno));
        break;
+      }
       count += ret;
       akt = time (NULL);
       if (akt - start > 30)
       {
        bytes_per_s = count / (akt - start);
        bytes_per_s /= 1024;
-       printf ("recv %f kb/s\n", bytes_per_s); 
+       printf ("recv %f kb/s\n", bytes_per_s);
        start = akt;
        count = 0;
       }