summaryrefslogtreecommitdiff
path: root/expreserve.c
diff options
context:
space:
mode:
Diffstat (limited to 'expreserve.c')
-rw-r--r--expreserve.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/expreserve.c b/expreserve.c
index 29a1b4b..d6c3c9b 100644
--- a/expreserve.c
+++ b/expreserve.c
@@ -102,6 +102,9 @@ static char sccsid[] UNUSED = "@(#)expreserve.c 1.23 (gritter) 11/27/04";
#include <stdlib.h>
#include <pwd.h>
#include <time.h>
+#if !defined(HAVE_STRLCPY) || !defined(HAVE_STRLCAT)
+# include "compat.h"
+#endif
#include "config.h"
@@ -217,6 +220,7 @@ main(int argc, char **argv)
struct dirent *dirent;
struct stat stbuf;
+ (void)argv;
#ifdef LANGMSG
setlocale(LC_MESSAGES, "");
catd = catopen(CATNAME, NL_CAT_LOCALE);
@@ -272,7 +276,7 @@ main(int argc, char **argv)
#ifdef notdef
char pattern[] = "/usr/preserve/Exaa`XXXXX";
#else
-char pattern[] = "/var/lib/ex/Exa`XXXXXXXXXX";
+char pattern[] = PRESERVEDIR "/Exa`XXXXXXXXXX";
#endif
/*
@@ -296,7 +300,7 @@ notify(uid_t uid, char *fname, int flag, time_t time)
timestamp = ctime(&time);
timestamp[16] = 0; /* blast from seconds on */
putenv("MAILRC=/dev/null");
- sprintf(cmd, "/usr/bin/mail %s", pp->pw_name);
+ snprintf(cmd, sizeof cmd, "/bin/mail %s", pp->pw_name);
setuid(getuid());
mf = popen(cmd, "w");
if (mf == NULL)
@@ -308,7 +312,7 @@ notify(uid_t uid, char *fname, int flag, time_t time)
* error message. Usually, either it was forcably terminated
* or the phone was hung up, but we don't know which.
*/
- sprintf(croak, flag
+ snprintf(croak, sizeof croak, flag
? catgets(catd, 3, 2, "the system went down")
: catgets(catd, 3, 3, "the editor was killed"));
if (fname[0] == 0) {
@@ -426,7 +430,7 @@ format:
* LOST, by putting this in the header.
*/
if (H.Savedfile[0] == 0) {
- strcpy(H.Savedfile, "LOST");
+ memcpy(H.Savedfile, "LOST", 5);
ignore(write(0, (char *) &H, sizeof H));
H.Savedfile[0] = 0;
lseek(0, (off_t) 0, SEEK_SET);