-trying to fix perm problem despite SUID
authorChristian Grothoff <christian@grothoff.org>
Fri, 20 Jul 2012 11:06:57 +0000 (11:06 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 20 Jul 2012 11:06:57 +0000 (11:06 +0000)
src/transport/gnunet-helper-transport-wlan.c

index 363925cad7c9ac2593136720804a206156fe9346..cc3891b02f21de02f7f5cdf75c6de06532d56bf5 100644 (file)
@@ -1868,6 +1868,11 @@ main (int argc, char *argv[])
   struct MessageStreamTokenizer *stdin_mst;
   int raw_eno;
 
+  /* make use of SGID capabilities on POSIX */
+  /* FIXME: this might need a port on systems without 'getresgid' */
+  if (-1 ==  setreuid (0, 0))
+    fprintf (stderr, "setreuid failed: %s\n", strerror (errno));
+
   memset (&dev, 0, sizeof (dev));
   dev.fd_raw = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL));
   raw_eno = errno; /* remember for later */