diff options
author | 2017-07-24 12:57:01 +0000 | |
---|---|---|
committer | 2017-07-24 12:57:01 +0000 | |
commit | b16d157892676c789e96bbd3fa5d4a9b7a01f655 (patch) | |
tree | ab9776600e3f41d764c4508209b48fbe6a1a18b5 | |
parent | Use pledge(2) (diff) | |
download | wireguard-openbsd-b16d157892676c789e96bbd3fa5d4a9b7a01f655.tar.xz wireguard-openbsd-b16d157892676c789e96bbd3fa5d4a9b7a01f655.zip |
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.c | 24 |
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) |