generic: Hurd build fixes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-02-01 04:13:11 +02:00
parent cf68640e13
commit 2cd9559a3e
6 changed files with 34 additions and 23 deletions

View file

@ -42,9 +42,7 @@
#include <pwd.h>
#include <assert.h>
#include <sys/stat.h>
#ifdef Q_OS_UNIX
#include <limits.h> // PATH_MAX
#endif
class KArchivePrivate
{

View file

@ -57,16 +57,30 @@ KFileSystemType::Type determineFileSystemTypeImpl(const QByteArray& path)
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
# include <sys/vfs.h>
# include <linux/magic.h>
// LSB 3.2 has statfs in sys/statfs.h, sys/vfs.h is just an empty dummy header
# include <sys/statfs.h>
# ifndef AUTOFSNG_SUPER_MAGIC
# define AUTOFSNG_SUPER_MAGIC 0x7d92b1a0
# if defined(Q_OS_LINUX)
# include <linux/magic.h>
# endif
# ifndef NFS_SUPER_MAGIC
# define NFS_SUPER_MAGIC 0x00006969
# endif
# ifndef AUTOFS_SUPER_MAGIC
# define AUTOFS_SUPER_MAGIC 0x00000187
# endif
# ifndef MSDOS_SUPER_MAGIC
# define MSDOS_SUPER_MAGIC 0x00004d44
# endif
# ifndef SMB_SUPER_MAGIC
# define SMB_SUPER_MAGIC 0x0000517B
#endif
# ifndef FUSE_SUPER_MAGIC
# define FUSE_SUPER_MAGIC 0x65735546
# endif
# ifndef RAMFS_MAGIC
# define RAMFS_MAGIC 0x858458F6
# endif
// Reverse-engineering without C++ code:
// strace stat -f /mnt 2>&1|grep statfs|grep mnt, and look for f_type

View file

@ -63,6 +63,10 @@
#define case_sensitivity Qt::CaseSensitive
#ifndef PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
@ -796,8 +800,8 @@ KStandardDirs::KStandardDirsPrivate::realPath(const QString &dirname)
return dirname;
}
char realpath_buffer[MAXPATHLEN + 1];
memset(realpath_buffer, 0, MAXPATHLEN + 1);
char realpath_buffer[PATH_MAX + 1];
memset(realpath_buffer, 0, PATH_MAX + 1);
/* If the path contains symlinks, get the real name */
if (realpath( QFile::encodeName(dirname).constData(), realpath_buffer) != 0) {
@ -846,8 +850,8 @@ KStandardDirs::realPath(const QString &dirname) const
QString
KStandardDirs::realFilePath(const QString &filename)
{
char realpath_buffer[MAXPATHLEN + 1];
memset(realpath_buffer, 0, MAXPATHLEN + 1);
char realpath_buffer[PATH_MAX + 1];
memset(realpath_buffer, 0, PATH_MAX + 1);
/* If the path contains symlinks, get the real name */
if (realpath( QFile::encodeName(filename).constData(), realpath_buffer) != 0) {
@ -1355,9 +1359,9 @@ static QString readEnvPath(const char *env)
#ifdef Q_OS_LINUX
static QString executablePrefix()
{
char path_buffer[MAXPATHLEN + 1];
path_buffer[MAXPATHLEN] = 0;
int length = readlink ("/proc/self/exe", path_buffer, MAXPATHLEN);
char path_buffer[PATH_MAX + 1];
path_buffer[PATH_MAX] = 0;
int length = readlink ("/proc/self/exe", path_buffer, PATH_MAX);
if (length == -1)
return QString();

View file

@ -25,7 +25,6 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
@ -36,6 +35,10 @@
#include <limits.h>
#endif
#ifndef PATH_MAX
# define PATH_MAX _POSIX_PATH_MAX
#endif
int check_tmp_dir(const char *tmp_dir, int check_ownership);
int create_link(const char *file, const char *tmp_dir);
int build_link(const char* tmp, const char *tmp_prefix, const char *kde_prefix);

View file

@ -46,10 +46,6 @@
#include <pwd.h>
#include <stdlib.h>
#if defined(HAVE_LIMITS_H)
#include <limits.h> // PATH_MAX
#endif
//sendfile has different semantics in different platforms
#if defined HAVE_SENDFILE && defined Q_OS_LINUX
#define USE_SENDFILE 1

View file

@ -107,11 +107,7 @@ extern "C" {
#define TTY_GROUP "tty"
#ifndef PATH_MAX
# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
# else
# define PATH_MAX 1024
# endif
# define PATH_MAX _POSIX_PATH_MAX
#endif
///////////////////////