|
|
@ -590,17 +590,22 @@ int runDCOP( QCStringList args, UserList users, Session session,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( users.count() > 1 || ( users.count() == 1 &&
|
|
|
|
if ((users.count() > 1) || ((users.count() == 1) &&
|
|
|
|
( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
|
|
|
|
((getenv("ICEAUTHORITY") == 0) || (getenv("DISPLAY") == 0))))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Check for ICE authority file and if the file can be read by us
|
|
|
|
// Check for ICE authority file and if the file can be read by us
|
|
|
|
TQString iceFileBase = "ICEauthority";
|
|
|
|
TQString iceFileBase = "ICEauthority";
|
|
|
|
TQString iceFile;
|
|
|
|
TQString iceFile;
|
|
|
|
TQFileInfo fi;
|
|
|
|
TQFileInfo fi;
|
|
|
|
|
|
|
|
|
|
|
|
if (getenv("XDG_RUNTIME_DIR") != 0 )
|
|
|
|
TQString xdgRuntimeDir = TQString::fromLocal8Bit(getenv("XDG_RUNTIME_DIR"));
|
|
|
|
|
|
|
|
if (xdgRuntimeDir.isEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
xdgRuntimeDir = "/run/user/<uid>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!xdgRuntimeDir.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQFileInfo xdgRuntime(getenv("XDG_RUNTIME_DIR"));
|
|
|
|
TQFileInfo xdgRuntime(xdgRuntimeDir);
|
|
|
|
passwd* pstruct = getpwnam(it.key().local8Bit());
|
|
|
|
passwd* pstruct = getpwnam(it.key().local8Bit());
|
|
|
|
if (pstruct)
|
|
|
|
if (pstruct)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -617,19 +622,19 @@ int runDCOP( QCStringList args, UserList users, Session session,
|
|
|
|
iceFile = TQString("%1/.%2").arg(it.data()).arg(iceFileBase);
|
|
|
|
iceFile = TQString("%1/.%2").arg(it.data()).arg(iceFileBase);
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( iceFile.isEmpty() )
|
|
|
|
if (iceFile.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr_ << "WARNING: Cannot determine home directory for user "
|
|
|
|
cerr_ << "WARNING: Cannot determine home directory for user "
|
|
|
|
<< it.key() << "!" << endl
|
|
|
|
<< it.key() << "!" << endl
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( fi.exists() )
|
|
|
|
else if (fi.exists())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( fi.isReadable() )
|
|
|
|
if (fi.isReadable())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *envStr = strdup( ( "ICEAUTHORITY=" + iceFile ).ascii() );
|
|
|
|
char *envStr = strdup(("ICEAUTHORITY=" + iceFile).local8Bit());
|
|
|
|
putenv( envStr );
|
|
|
|
putenv(envStr);
|
|
|
|
//cerr_ << "ice: " << envStr << endl;
|
|
|
|
//cerr_ << "ice: " << envStr << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -642,8 +647,10 @@ int runDCOP( QCStringList args, UserList users, Session session,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( users.count() > 1 )
|
|
|
|
if (users.count() > 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr_ << "WARNING: Cannot find ICE authority file "
|
|
|
|
cerr_ << "WARNING: Cannot find ICE authority file "
|
|
|
|