* runs a Current session and saves the session.
*/
strcpy (savedDir, smGD.clientPath);
- sprintf(smGD.etcPath, "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
+ snprintf(smGD.etcPath, sizeof(smGD.etcPath), "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
status = stat(smGD.etcPath, &buf);
if(status == 0)
{
*/
char * tmpName;
- sprintf(smGD.etcPath, "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
+ snprintf(smGD.etcPath, sizeof(smGD.etcPath), "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
status = stat(smGD.etcPath, &buf);
if(status == 0)
{
len = strlen(smGD.savePath) + strlen(smGD.restoreSession)
+ strlen("XXXXXX") + 3;
tmpName = (char *) XtCalloc(1, len);
- sprintf(tmpName, "%s/%s.XXXXXX", smGD.savePath,
+ snprintf(tmpName, len, "%s/%s.XXXXXX", smGD.savePath,
smGD.restoreSession);
strcpy (savedOldDir, smGD.etcPath);
*/
if (len + strlen(DtERRORLOG_FILE) > MAXPATHLEN)
checkPath1 = SM_REALLOC(savePath, len + strlen(DtERRORLOG_FILE));
- sprintf(checkPath1, "%s/%s", savePath, DtERRORLOG_FILE);
+ snprintf(checkPath1, len + strlen(DtERRORLOG_FILE), "%s/%s", savePath, DtERRORLOG_FILE);
status = stat(checkPath1, &buf);
if((status != -1) && (buf.st_size > 0))
{
int slen = strlen(tstr) + 1;
defaultCwd = XtCalloc(1, slen);
- strncpy(defaultCwd, tstr, slen - 1);
+ snprintf(defaultCwd, slen, "%s", tstr);
}
else
defaultCwd = getcwd (NULL, MAXPATHLEN + 1);
if (!env) {
free (networkIds);
PostXSMPFailureDialog (XSMP_FAILURE_MALLOC, False);
+ } else {
+ (void) sprintf (env, "%s=%s", SM_SESSION_MANAGER, networkIds);
+ (void) putenv (env);
}
-
- (void) sprintf (env, "%s=%s", SM_SESSION_MANAGER, networkIds);
- (void) putenv (env);
PutSessionManagerOnRootWindow (networkIds);