summaryrefslogtreecommitdiff
path: root/saveutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'saveutil.c')
-rw-r--r--saveutil.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/saveutil.c b/saveutil.c
index 0e81785..cd020dd 100644
--- a/saveutil.c
+++ b/saveutil.c
@@ -47,9 +47,8 @@ set_session_save_file_name(char *session_name)
p = ".";
}
- strcpy (session_save_file, p);
- strcat (session_save_file, "/.XSM-");
- strcat (session_save_file, session_name);
+ snprintf (session_save_file, sizeof(session_save_file),
+ "%s/.XSM-%s", p, session_name);
}
@@ -314,8 +313,8 @@ WriteSave(char *sm_id)
{
char msg[256];
- sprintf (msg, "%s: Error creating session save file %s",
- Argv[0], session_save_file);
+ snprintf (msg, sizeof(msg), "%s: Error creating session save file %s",
+ Argv[0], session_save_file);
add_log_text (msg);
perror (msg);
}
@@ -426,7 +425,7 @@ DeleteSession(char *session_name)
dir = ".";
}
- sprintf (filename, "%s/.XSM-%s", dir, session_name);
+ snprintf (filename, sizeof(filename), "%s/.XSM-%s", dir, session_name);
f = fopen(filename, "r");
if(!f) {
@@ -510,7 +509,7 @@ DeleteSession(char *session_name)
if (buf)
free (buf);
- return ((unlink (filename) == -1) ? 0 : 1);
+ return ((remove (filename) == -1) ? 0 : 1);
}