diff --git a/CHANGELOG b/CHANGELOG index b5cbde1..c3bbf29 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,9 +11,9 @@ nsmd now follows the XDG Base Directory Specifications: The old path ~/NSM Sessions/ is still supported and has priority, for now. This may be switched off in the future. Lockfiles fixed (see issue #gh-31) Lockfiles are now in $XDG_RUNTIME_DIR/nsm/ - Lockfiles now each contain the session path, the osc NSM_URL and the nsmd PID. - New section in the API documentation to explain the above. - + Lockfiles now each contain the session path, the osc NSM_URL and the nsmd PID + New section in the API documentation for the above. +Fixes and guards against trying to load non-existing sessions and creating new sessions under existing names ## 2022-01-15 1.5.3 Add [jackpatch] to terminal log output of jackpatch. diff --git a/src/nsmd.cpp b/src/nsmd.cpp index f9fb671..ef2591c 100644 --- a/src/nsmd.cpp +++ b/src/nsmd.cpp @@ -1359,6 +1359,14 @@ tell_all_clients_session_is_loaded ( void ) int load_session_file ( const char * path ) { + //parameter "path" is the absolute path to the session including session root, without session.nsm + + //First check if the session file actually exists, before closing the current one + if ( session_already_exists( basename( strdup(path )) ) != 0) { + WARNING ("Instructed to load %s which does not exist. Doing nothing.", path); + return ERR_NO_SUCH_FILE; + } + if ( session_path && session_name ) { //We are already in a session. This is switch, or load during duplicate etc.