From 10bd0252cda8b1989bdc0801174e58a920d22a19 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 18 Nov 2011 11:02:25 +0000 Subject: [PATCH] make locksession a bit more robust by calling FS_CreatePath just in case git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11564 d7cf8633-e32d-0410-b094-e92efae38249 --- host.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/host.c b/host.c index a8a8e0de..d08795a2 100644 --- a/host.c +++ b/host.c @@ -1100,17 +1100,19 @@ void Host_LockSession(void) if(locksession.integer != 0) { char vabuf[1024]; - locksession_fh = FS_SysOpen(va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string), "wl", false); + char *p = va(vabuf, sizeof(vabuf), "%slock%s", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string); + FS_CreatePath(p); + locksession_fh = FS_SysOpen(p, "wl", false); // TODO maybe write the pid into the lockfile, while we are at it? may help server management tools if(!locksession_fh) { if(locksession.integer == 2) { - Con_Printf("WARNING: session lock %slock%s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string); + Con_Printf("WARNING: session lock %s could not be acquired. Please run with -sessionid and an unique session name. Continuing anyway.\n", p); } else { - Sys_Error("session lock %slock%s could not be acquired. Please run with -sessionid and an unique session name.\n", *fs_userdir ? fs_userdir : fs_basedir, sessionid.string); + Sys_Error("session lock %s could not be acquired. Please run with -sessionid and an unique session name.\n", p); } } } -- 2.39.2