SCCS-vsn: libexec/mail.local/mail.local.c 5.9
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mail.local.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)mail.local.c 5.9 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <netdb.h>
#include <pwd.h>
#include <fcntl.h>
#include <netdb.h>
#include <pwd.h>
-#include <time.h>
-#include <unistd.h>
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <syslog.h>
+#include <time.h>
+#include <unistd.h>
+
#include "pathnames.h"
#define FATAL 1
#include "pathnames.h"
#define FATAL 1
int store __P((char *));
void usage __P((void));
int store __P((char *));
void usage __P((void));
main(argc, argv)
int argc;
char **argv;
main(argc, argv)
int argc;
char **argv;
store(from)
char *from;
{
store(from)
char *from;
{
char *tn, line[2048];
tn = strdup(_PATH_LOCTMP);
char *tn, line[2048];
tn = strdup(_PATH_LOCTMP);
- if ((fd = mkstemp(tn)) == -1 || !(fp = fdopen(fd, "w+")))
+ if ((fd = mkstemp(tn)) == -1 || (fp = fdopen(fd, "w+")) == NULL)
err(FATAL, "unable to open temporary file");
(void)unlink(tn);
free(tn);
err(FATAL, "unable to open temporary file");
(void)unlink(tn);
free(tn);
deliver(fd, name)
int fd;
char *name;
deliver(fd, name)
int fd;
char *name;
- (void)sprintf(path, "%s/%s", _PATH_MAILDIR, name);
+ (void)snprintf(path, sizeof(path), "%s/%s", _PATH_MAILDIR, name);
if (!(created = lstat(path, &sb)) &&
(sb.st_nlink != 1 || S_ISLNK(sb.st_mode))) {
if (!(created = lstat(path, &sb)) &&
(sb.st_nlink != 1 || S_ISLNK(sb.st_mode))) {
}
curoff = lseek(mbfd, (off_t)0, SEEK_END);
}
curoff = lseek(mbfd, (off_t)0, SEEK_END);
- (void)sprintf(biffmsg, "%s@%qd\n", name, curoff);
+ (void)snprintf(biffmsg, sizeof(biffmsg), "%s@%qd\n", name, curoff);
if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
err(FATAL, "temporary file: %s", strerror(errno));
rval = 1;
if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
err(FATAL, "temporary file: %s", strerror(errno));
rval = 1;