]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make locksession a bit more robust by calling FS_CreatePath just in case
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Nov 2011 11:02:25 +0000 (11:02 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Nov 2011 11:02:25 +0000 (11:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11564 d7cf8633-e32d-0410-b094-e92efae38249

host.c

diff --git a/host.c b/host.c
index a8a8e0de767d63be34b39acf583f824f0e9aea70..d08795a24aaef8665a50f2ba294e3f70361d287f 100644 (file)
--- 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);
                        }
                }
        }