Skip to content

Commit

Permalink
#963:
Browse files Browse the repository at this point in the history
* drop the "sockdir" prefix and check for directories by looking for the trailing slash or checking if they exist already
* support path extension using $UID and $GID as per socket-dirs

git-svn-id: https://xpra.org/svn/Xpra/trunk@11486 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 26, 2015
1 parent 7957364 commit bff278e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ def bstr(b):
if WIN32:
bind = ""
else:
bind = socket_dirs[0]
def addtrailingslash(v):
if v.endswith("/"):
return v
return v+"/"
bind = addtrailingslash(socket_dirs[0])
#FIXME: we should probably get these values from the default config instead
pdf, postscript = "", ""
if os.name=="posix" and printing_ENABLED:
Expand Down
6 changes: 5 additions & 1 deletion src/xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,14 @@ def get_defaults():
xvfb = get_Xdummy_command(use_wrapper=XDUMMY_WRAPPER)
else:
xvfb = get_Xvfb_command()
def addtrailingslash(v):
if v.endswith("/"):
return v
return v+"/"
if WIN32:
bind_dirs = []
else:
bind_dirs = [get_socket_dirs()[0]]
bind_dirs = [addtrailingslash(get_socket_dirs()[0])]

GLOBAL_DEFAULTS = {
"encoding" : "",
Expand Down
14 changes: 4 additions & 10 deletions src/xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from xpra.scripts.main import TCP_NODELAY, warn, no_gtk
from xpra.scripts.config import InitException
from xpra.os_util import SIGNAMES
from xpra.dotxpra import DotXpra, norm_makepath
from xpra.dotxpra import DotXpra, norm_makepath, osexpand


# use process polling with python versions older than 2.7 and 3.0, (because SIGCHLD support is broken)
Expand Down Expand Up @@ -341,18 +341,12 @@ def setup_local_sockets(bind, socket_dir, socket_dirs, display_name, clobber, mm
continue
elif b=="auto":
sockpath = dotxpra.socket_path(display_name)
elif b.startswith("sockdir:"):
sockdir = b[len("sockdir:"):]
sockpath = norm_makepath(sockdir, display_name)
else:
if b.startswith("/"):
sockpath = b
elif b.startswith("~"):
sockpath = os.path.expanduser(b)
if sockpath.endswith("/") or (os.path.exists(sockpath) and os.path.isdir(sockpath)):
sockpath = osexpand(b)
if b.endswith("/") or (os.path.exists(sockpath) and os.path.isdir(sockpath)):
sockpath = os.path.abspath(sockpath)
if not os.path.exists(sockpath):
os.mkdir(sockpath)
os.makedirs(sockpath)
sockpath = norm_makepath(sockpath, display_name)
else:
sockpath = dotxpra.socket_path(display_name)
Expand Down

0 comments on commit bff278e

Please sign in to comment.