diff options
author | Timothy Pearson <[email protected]> | 2013-04-19 12:50:40 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-04-19 12:50:40 -0500 |
commit | 5f4287e56dd5c1feecc08843aae1d4e4b8835d1e (patch) | |
tree | 16ee641017a3a2f176b6a7291482b6146381e46d /kdesktop/lock/lockprocess.cc | |
parent | 6640770b3239ad117d29df2929e5b7442e48ee3a (diff) | |
download | tdebase-5f4287e56dd5c1feecc08843aae1d4e4b8835d1e.tar.gz tdebase-5f4287e56dd5c1feecc08843aae1d4e4b8835d1e.zip |
Fix Documents folder creation dialog
This resolves Bug 976
Prevent multiple kdesktop_lock processes from spawning per user
Diffstat (limited to 'kdesktop/lock/lockprocess.cc')
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 8d840983e..d1cf95212 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -2698,25 +2698,42 @@ ControlPipeHandlerObject::~ControlPipeHandlerObject() { } void ControlPipeHandlerObject::run(void) { + int display_number = atoi(TQString(XDisplayString(tqt_xdisplay())).replace(":","").ascii()); + + if (display_number < 0) { + printf("[kdesktop_lock] Warning: unable to create control socket. Interactive logon modules may not function properly.\n\r"); + return; + } + + char fifo_file[PATH_MAX]; + char fifo_file_out[PATH_MAX]; + snprintf(fifo_file, PATH_MAX, FIFO_FILE, display_number); + snprintf(fifo_file_out, PATH_MAX, FIFO_FILE_OUT, display_number); + /* Create the FIFOs if they do not exist */ umask(0); mkdir(FIFO_DIR,0644); - mknod(FIFO_FILE, S_IFIFO|0644, 0); - chmod(FIFO_FILE, 0644); + mknod(fifo_file, S_IFIFO|0644, 0); + chmod(fifo_file, 0644); - mParent->mPipe_fd = open(FIFO_FILE, O_RDONLY | O_NONBLOCK); + mParent->mPipe_fd = open(fifo_file, O_RDONLY | O_NONBLOCK); if (mParent->mPipe_fd > -1) { mParent->mPipeOpen = true; } - mknod(FIFO_FILE_OUT, S_IFIFO|0600, 0); - chmod(FIFO_FILE_OUT, 0600); + mknod(fifo_file_out, S_IFIFO|0600, 0); + chmod(fifo_file_out, 0600); - mParent->mPipe_fd_out = open(FIFO_FILE_OUT, O_RDWR | O_NONBLOCK); + mParent->mPipe_fd_out = open(fifo_file_out, O_RDWR | O_NONBLOCK); if (mParent->mPipe_fd_out > -1) { mParent->mPipeOpen_out = true; } + if (!mParent->mPipeOpen) { + printf("[kdesktop_lock] Warning: unable to create control socket '%s'. Interactive logon modules may not function properly.\n\r", fifo_file); + return; + } + int numread; int retval; fd_set rfds; |