generic: DragonFly BSD build fixes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-12-25 00:14:07 +00:00
parent b8e0493fa8
commit d2c5598a0f
7 changed files with 7 additions and 45 deletions

View file

@ -43,7 +43,7 @@ inline KFileSystemType::Type kde_typeFromName(const char *name)
return KFileSystemType::Other;
}
#if defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD)
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY) || defined(Q_OS_OPENBSD)
# include <sys/param.h>
# include <sys/mount.h>

View file

@ -238,45 +238,8 @@ void KProcess::setShellCommand(const QString &cmd)
d->args.clear();
#ifdef Q_OS_UNIX
// #ifdef NON_FREE // ... as they ship non-POSIX /bin/sh
# if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__GNU__)
// If /bin/sh is a symlink, we can be pretty sure that it points to a
// POSIX shell - the original bourne shell is about the only non-POSIX
// shell still in use and it is always installed natively as /bin/sh.
d->prog = QFile::symLinkTarget(QString::fromLatin1("/bin/sh"));
if (d->prog.isEmpty()) {
// Try some known POSIX shells.
d->prog = KStandardDirs::findExe(QString::fromLatin1("ksh"));
if (d->prog.isEmpty()) {
d->prog = KStandardDirs::findExe(QString::fromLatin1("ash"));
if (d->prog.isEmpty()) {
d->prog = KStandardDirs::findExe(QString::fromLatin1("bash"));
if (d->prog.isEmpty()) {
d->prog = KStandardDirs::findExe(QString::fromLatin1("zsh"));
if (d->prog.isEmpty())
// We're pretty much screwed, to be honest ...
d->prog = QString::fromLatin1("/bin/sh");
}
}
}
}
# else
d->prog = QString::fromLatin1("/bin/sh");
# endif
d->args << QString::fromLatin1("-c") << cmd;
#else // Q_OS_UNIX
// KMacroExpander::expandMacrosShellQuote(), KShell::quoteArg() and
// KShell::joinArgs() may generate these for security reasons.
setEnv(PERCENT_VARIABLE, QLatin1String("%"));
WCHAR sysdir[MAX_PATH + 1];
UINT size = GetSystemDirectoryW(sysdir, MAX_PATH + 1);
d->prog = QString::fromUtf16((const ushort *) sysdir, size);
d->prog += QLatin1String("\\cmd.exe");
setNativeArguments(QLatin1String("/V:OFF /S /C \"") + cmd + QLatin1Char('"'));
#endif
}
QStringList KProcess::program() const

View file

@ -77,8 +77,7 @@ void KProcessTest::test_channels()
void KProcessTest::test_setShellCommand()
{
// Condition copied from kprocess.cpp
#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__GNU__)
#if !defined(Q_OS_UNIX)
QSKIP("This test needs a free UNIX system", SkipSingle);
#else
KProcess p;

View file

@ -1847,7 +1847,7 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr
static bool fileSystemSupportsACL( const QByteArray& path )
{
bool fileSystemSupportsACLs = false;
#ifdef Q_OS_FREEBSD
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
struct statfs buf;
fileSystemSupportsACLs = ( statfs( path.data(), &buf ) == 0 ) && ( buf.f_flags & MNT_ACLS );
#else

View file

@ -98,7 +98,7 @@ extern "C" {
#if defined HAVE_TCGETATTR
# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(__DragonFly__)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_DRAGONFLY)
# define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
#else
# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
@ -106,7 +106,7 @@ extern "C" {
#if defined HAVE_TCSETATTR
# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(__DragonFly__)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_DRAGONFLY)
# define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
#else
# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)

View file

@ -44,7 +44,7 @@
# include <sys/time.h>
#endif
#if defined(Q_OS_FREEBSD)
#if defined(Q_OS_FREEBSD) || defined(Q_OS_DRAGONFLY)
// "the other end's output queue size" - kinda braindead, huh?
# define PTY_BYTES_AVAILABLE TIOCOUTQ
#elif defined(TIOCINQ)

View file

@ -179,7 +179,7 @@ void UDisksStorageAccess::slotDBusReply( const QDBusMessage & reply )
QString program = "cdio";
QStringList args;
args << "-f" << devnode << "eject";
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_DRAGONFLY)
devnode.remove("/dev/").replace("([0-9]).", "\\1");
QString program = "cdcontrol";
QStringList args;