-more logging, avoid duplicate re-scheduling
[oweals/gnunet.git] / src / transport / gnunet-helper-transport-bluetooth.c
index 2d1b67dfe2d977fe239f643980e175d7bbcad45a..acb6d24d514d76a0f96a590001383017edb9a3ff 100644 (file)
@@ -1,8 +1,8 @@
 /*
    This file is part of GNUnet.
-   (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
+   Copyright (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
    Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com>
-   Copyright (C) 2009 Thomas d'Otreppe
+   Copyright Copyright (C) 2009 Thomas d'Otreppe
 
    GNUnet is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
@@ -16,8 +16,8 @@
 
    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.
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
 */
 #include "gnunet_config.h"
 
@@ -965,7 +965,7 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
     sdp_list_t *search_list = 0, *attrid_list = 0, *response_list = 0, *it = 0;
     uuid_t svc_uuid;
     uint32_t range = 0x0000ffff;
-    uint8_t channel = -1;
+    int channel = -1;
 
     /* Connect to the local SDP server */
     session = sdp_connect (BDADDR_ANY, &dest, 0);
@@ -1002,9 +1002,12 @@ check_crc_buf_osdep (const unsigned char *buf, size_t len)
 
     sdp_close (session);
 
-    if (channel == -1)
-      fprintf (stderr, "Failed to find the listening channel for interface `%.*s': %s\n",
-              IFNAMSIZ, dev->iface, strerror (errno));
+    if (-1 == channel)
+      fprintf (stderr,
+               "Failed to find the listening channel for interface `%.*s': %s\n",
+               IFNAMSIZ,
+               dev->iface,
+               strerror (errno));
 
     return channel;
   }
@@ -1664,24 +1667,30 @@ main (int argc, char *argv[])
     int stdin_open;
     struct MessageStreamTokenizer *stdin_mst;
     int raw_eno, i;
-    uid_t uid;
     int crt_rfds = 0, rfds_list[MAX_PORTS];
     int broadcast, sendsocket;
+
     /* Assert privs so we can modify the firewall rules! */
-    uid = getuid ();
-  #ifdef HAVE_SETRESUID
-    if (0 != setresuid (uid, 0, 0))
-    {
-      fprintf (stderr, "Failed to setresuid to root: %s\n", strerror (errno));
-      return 254;
-    }
-  #else
-    if (0 != seteuid (0))
     {
-      fprintf (stderr, "Failed to seteuid back to root: %s\n", strerror (errno));
-      return 254;
+#ifdef HAVE_SETRESUID
+      uid_t uid = getuid ();
+
+      if (0 != setresuid (uid, 0, 0))
+      {
+       fprintf (stderr, 
+                "Failed to setresuid to root: %s\n",
+                strerror (errno));
+       return 254;
+      }
+#else
+      if (0 != seteuid (0))
+      {
+       fprintf (stderr, 
+                "Failed to seteuid back to root: %s\n", strerror (errno));
+       return 254;
+      }
+#endif
     }
-  #endif
 
     /* Make use of SGID capabilities on POSIX */
     memset (&dev, 0, sizeof (dev));