rem: sprintf(buf, "WMState.%i", scr->screen);
add: snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
context: wScreenSaveState(WScreen *scr){    WWindow *wwin;    char *str;    proplist_t path, old_state, foo;    CARD32 data[2];    make_keys();    /* Save current workspace, so can go back to it upon restart. */    data[0] = scr->current_workspace;    data[1] = WFLAGS_NONE;    XChangeProperty(dpy, scr->root_win, _XA_WINDOWMAKER_STATE,                    _XA_WINDOWMAKER_STATE, 32, PropModeReplace,                    (unsigned char *) data, 2);        /* save state of windows */    wwin = scr->focused_window;    while (wwin) {	wWindowSaveState(wwin);	wwin = wwin->prev;    }    if (wPreferences.flags.noupdates)	return;    old_state = scr->session_state;    scr->session_state = PLMakeDictionaryFromEntries(NULL, NULL, NULL);    PLSetStringCmpHook(NULL);    /* save dock state to file */    if (!wPreferences.flags.nodock) {        wDockSaveState(scr, old_state);    } else {        if ((foo = PLGetDictionaryEntry(old_state, dDock))!=NULL) {            PLInsertDictionaryEntry(scr->session_state, dDock, foo);        }    }    if (!wPreferences.flags.noclip) {        wClipSaveState(scr);    } else {        if ((foo = PLGetDictionaryEntry(old_state, dClip))!=NULL) {            PLInsertDictionaryEntry(scr->session_state, dClip, foo);        }    }    wWorkspaceSaveState(scr, old_state);    if (wPreferences.save_session_on_exit) {        wSessionSaveState(scr);    } else {        if ((foo = PLGetDictionaryEntry(old_state, dApplications))!=NULL) {            PLInsertDictionaryEntry(scr->session_state, dApplications, foo);        }        if ((foo = PLGetDictionaryEntry(old_state, dWorkspace))!=NULL) {            PLInsertDictionaryEntry(scr->session_state, dWorkspace, foo);        }    }    /* clean up */    PLSetStringCmpHook(StringCompareHook);    wMenuSaveState(scr);    if (wScreenCount == 1)	str = wdefaultspathfordomain("WMState");    else {	char buf[16];	sprintf(buf, "WMState.%i", scr->screen);	str = wdefaultspathfordomain(buf);    }    path = PLMakeString(str);    wfree(str);    PLSetFilename(scr->session_state, path);    if (!PLSave(scr->session_state, YES)) {	wsyserror(_("could not save session state in %s"), PLGetString(path));    }    PLRelease(path);    PLRelease(old_state);}