Re: dcopserver statup problem and /tmp/.ICE-unix

Stefan Teleman <[email protected]>
Newsgroups gmane.comp.kde.solaris
Organization Disorganized
Message-ID <[email protected]>
On Saturday 11 February 2006 19:49, Avi Schwartz wrote:
> > Is this a Blastwave related question ?
>
> It is a KDE related question.  The build is the Blastwave build.

And the build doesn't handle this particular problem correctly, which 
a known problem, and has been known for years.

There are three directories under /tmp which need to have their 
permissions set correctly by the startup script:

/tmp/.ICE-unix
/tmp/.X11-unix
/tmp/.X11-pipe

/* kchmod.c */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

static const char* unixPath = "/tmp/.X11-unix";
static const char* pipePath = "/tmp/.X11-pipe";
static const char* icePath = "/tmp/.ICE-unix";
static const char* fontPath = "/tmp/.font-unix";
extern int errno;

int
main (int argc, char* argv[])
{
    mode_t mode = 0;
    uid_t uid = 0;
    gid_t gid = 0;

    mode = (S_IRWXU | S_IRWXG | S_IRWXO | S_ISVTX);

    if (setuid (uid) != 0)
    {
      perror ("setuid"), strerror (errno);
      return -1;
    }
    if (mkdir (unixPath, mode) != 0)
    {
      if (EEXIST != errno)
      {
        perror("mkdir"), strerror(errno);
        return -2;
      }
    }
    if (chmod (unixPath, mode) != 0)
      perror ("chmod"), strerror (errno);

    if (chown (unixPath, uid, gid) != 0)
      perror ("chown"), strerror (errno);

    if (mkdir (pipePath, mode) != 0)
    {
      if (EEXIST != errno)
      {
        perror("mkdir"), strerror(errno);
        return -2;
      }
    }
    if (chmod (pipePath, mode) != 0)
      perror ("chmod"), strerror (errno);

    if (chown (pipePath, uid, gid) != 0)
      perror ("chown"), strerror (errno);

    if (mkdir (icePath, mode) != 0)
    {
      if (EEXIST != errno)
      {
        perror("mkdir"), strerror(errno);
        return -2;
      }
    }
    if (chmod (icePath, mode) != 0)
      perror ("chmod"), strerror (errno);

    if (chown (icePath, uid, gid) != 0)
      perror ("chown"), strerror (errno);

    if (mkdir (fontPath, mode) != 0)
    {
      if (EEXIST != errno)
      {
        perror("mkdir"), strerror(errno);
        return -2;
      }
    }
    if (chmod (fontPath, mode) != 0)
      perror ("chmod"), strerror (errno);

    if (chown (fontPath, uid, gid) != 0)
      perror ("chown"), strerror (errno);

    return 0;
}

// vim: ts=2 sw=2 et

/* kchmod.c */

Compile and install as ${KDE}/bin/kchmod, permissions 4755, owned 
root:root and run it directly from startkde, somewhere near the top 
before anything KDE-related starts happening.

Do not keep deleting these directories because that will not fix 
anything.

--Stefan

-- 
Stefan Teleman          'Nobody Expects the Spanish Inquisition'
[email protected]                          -Monty Python
___________________________________________________
This message is from the kde-solaris mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde-solaris.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.