tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / util / os_installation.c
index b801f4f53e8f09383af8b3c9b29f0abc357f5414..f2d24f85e72eeae777177f132c7272222fdf24d5 100644 (file)
@@ -1,21 +1,21 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2006-2016 GNUnet e.V.
+     Copyright (C) 2006-2018 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 Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-     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., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 
 /**
@@ -44,9 +44,9 @@
 #endif
 
 
-#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+#define LOG(kind,...) GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__)
 
-#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-installation", syscall, filename)
 
 
 /**
@@ -152,14 +152,21 @@ get_path_from_proc_exe ()
   ssize_t size;
   char *lep;
 
-  GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/exe", getpid ());
-  size = readlink (fn, lnk, sizeof (lnk) - 1);
+  GNUNET_snprintf (fn,
+                  sizeof (fn),
+                  "/proc/%u/exe",
+                  getpid ());
+  size = readlink (fn,
+                  lnk,
+                  sizeof (lnk) - 1);
   if (size <= 0)
   {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
+    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR,
+                      "readlink",
+                      fn);
     return NULL;
   }
-  GNUNET_assert (size < sizeof (lnk));
+  GNUNET_assert ( ((size_t) size) < sizeof (lnk));
   lnk[size] = '\0';
   while ((lnk[size] != '/') && (size > 0))
     size--;
@@ -167,12 +174,13 @@ get_path_from_proc_exe ()
                    "/%s/libexec/",
                    current_pd->project_dirname);
   /* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */
-  if ( (size > strlen (lep)) &&
+  if ( (((size_t) size) > strlen (lep)) &&
        (0 == strcmp (lep,
                     &lnk[size - strlen (lep)])) )
     size -= strlen (lep) - 1;
   GNUNET_free (lep);
-  if ((size < 4) || (lnk[size - 4] != '/'))
+  if ( (size < 4) ||
+       (lnk[size - 4] != '/') )
   {
     /* not installed in "/bin/" -- binary path probably useless */
     return NULL;
@@ -903,6 +911,7 @@ GNUNET_OS_check_helper_binary (const char *binary,
   if (check_suid)
   {
 #ifndef MINGW
+    (void) params;
     if ( (0 != (statbuf.st_mode & S_ISUID)) &&
          (0 == statbuf.st_uid) )
     {