/*
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
*/
/**
#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)
/**
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--;
"/%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;
if (check_suid)
{
#ifndef MINGW
+ (void) params;
if ( (0 != (statbuf.st_mode & S_ISUID)) &&
(0 == statbuf.st_uid) )
{