summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-07-24 12:57:02 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-07-24 12:57:02 +0000
commit1d3ae6dc5571147d1f5a01a81fd91f2eb3c0c36f (patch)
treedac60575970c0fd5b2c8b8a49750a1fd1e26e1d3
parent478ed566787f25905b63ba8907ebe1a931364e15 (diff)
Simplify mail sending.
No need for asprintf(3) to concat two string literals. The resulting helper() function is trivial, so inline it. ok schwarze@
-rw-r--r--usr.bin/newsyslog/newsyslog.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index a636f31e72b..a73b822bb60 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.107 2017/07/22 17:06:40 jca Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.108 2017/07/24 12:57:01 jca Exp $ */
/*
* Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -147,7 +147,6 @@ char hostname[HOST_NAME_MAX+1]; /* Hostname */
char daytime[33]; /* timenow in human readable form */
char *arcdir; /* Dir to put archives in (if it exists) */
-FILE *openmail(void);
char *lstat_log(char *, size_t, int);
char *missing_field(char *, char *, int);
char *sob(char *);
@@ -1072,13 +1071,12 @@ domonitor(struct conf_entry *ent)
fclose(fp);
goto cleanup;
}
-
- /* Send message. */
fclose(fp);
- fp = openmail();
+ /* Send message. */
+ fp = popen(SENDMAIL " -t", "w");
if (fp == NULL) {
- warn("openmail");
+ warn("popen");
goto cleanup;
}
fprintf(fp, "Auto-Submitted: auto-generated\n");
@@ -1105,20 +1103,6 @@ cleanup:
return (1);
}
-FILE *
-openmail(void)
-{
- char *cmdbuf = NULL;
- FILE *ret;
-
- if (asprintf(&cmdbuf, "%s -t", SENDMAIL) != -1) {
- ret = popen(cmdbuf, "w");
- free(cmdbuf);
- return (ret);
- }
- return (NULL);
-}
-
/* ARGSUSED */
void
child_killer(int signo)