-/* $OpenBSD: atrun.c,v 1.31 2015/10/03 19:47:21 tedu Exp $ */
+/* $OpenBSD: atrun.c,v 1.32 2015/10/23 18:42:55 tedu Exp $ */
/*
* Copyright (c) 2002-2003 Todd C. Miller <Todd.Miller@courtesan.com>
/* Run a single batch job if there is one pending. */
if (batch != NULL
-#ifdef HAVE_GETLOADAVG
&& (batch_maxload == 0.0 ||
((getloadavg(&la, 1) == 1) && la <= batch_maxload))
-#endif
) {
snprintf(atfile, sizeof(atfile), "%s/%lld.%c", AT_DIR,
(long long)batch->run_time, batch->queue);
fprintf(mail, "To: %s\n", mailto);
fprintf(mail, "Subject: Output from \"at\" job\n");
fprintf(mail, "Auto-Submitted: auto-generated\n");
-#ifdef MAIL_DATE
- fprintf(mail, "Date: %s\n", arpadate(&StartTime));
-#endif /*MAIL_DATE*/
fprintf(mail, "\nYour \"at\" job on %s\n\"%s/%s/%s\"\n",
hostname, CRONDIR, AT_DIR, atfile);
fprintf(mail, "\nproduced the following output:\n\n");
-/* $OpenBSD: config.h,v 1.22 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: config.h,v 1.23 2015/10/23 18:42:55 tedu Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
*/
#define MAILARG _PATH_SENDMAIL /*-*/
-/* #define MAILFMT "%s -d %s" -*/
- /* -d = undocumented but common flag: deliver locally?
- */
-/* #define MAILARG "/bin/mail",mailto -*/
-
-/* #define MAILFMT "%s -mlrxto %s" -*/
-/* #define MAILARG "/usr/mmdf/bin/submit",mailto -*/
-
- /* if your OS has the paths.h header */
-#define HAVE_PATHS_H /*-*/
-
- /* if your OS has a getloadavg() function */
-#define HAVE_GETLOADAVG /*-*/
-
/* maximum load at which batch jobs will still run */
#define BATCH_MAXLOAD 1.5 /*-*/
-/* $OpenBSD: do_command.c,v 1.48 2015/10/03 19:47:21 tedu Exp $ */
+/* $OpenBSD: do_command.c,v 1.49 2015/10/23 18:42:55 tedu Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
usernm, first_word(hostname, "."),
e->cmd);
fprintf(mail, "Auto-Submitted: auto-generated\n");
-#ifdef MAIL_DATE
- fprintf(mail, "Date: %s\n",
- arpadate(&StartTime));
-#endif /*MAIL_DATE*/
for (env = e->envp; *env; env++)
fprintf(mail, "X-Cron-Env: <%s>\n",
*env);
-/* $OpenBSD: misc.c,v 1.56 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: misc.c,v 1.57 2015/10/23 18:42:55 tedu Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
struct stat sb;
struct group *grp = NULL;
-#ifdef CRON_GROUP
grp = getgrnam(CRON_GROUP);
-#endif
/* first check for CRONDIR ("/var/cron" or some such)
*/
if (stat(CRONDIR, &sb) < 0 && errno == ENOENT) {
return (dst);
}
-#ifdef MAIL_DATE
-/* Sat, 27 Feb 1993 11:44:51 -0800 (CST)
- * 1234567890123456789012345678901234567
- */
-char *
-arpadate(clock)
- time_t *clock;
-{
- time_t t = clock ? *clock : time(NULL);
- struct tm *tm = localtime(&t);
- static char ret[64]; /* zone name might be >3 chars */
- char *qmark;
- size_t len;
- long gmtoff = get_gmtoff(&t, tm);
- int hours = gmtoff / 3600;
- int minutes = (gmtoff - (hours * 3600)) / 60;
-
- if (minutes < 0)
- minutes = -minutes;
-
- /* Defensive coding (almost) never hurts... */
- len = strftime(ret, sizeof(ret), "%a, %e %b %Y %T ????? (%Z)", tm);
- if (len == 0) {
- ret[0] = '?';
- ret[1] = '\0';
- return (ret);
- }
- qmark = strchr(ret, '?');
- if (qmark && len - (qmark - ret) >= 6) {
- snprintf(qmark, 6, "% .2d%.2d", hours, minutes);
- qmark[5] = ' ';
- }
- return (ret);
-}
-#endif /*MAIL_DATE*/
static gid_t save_egid;
int swap_gids() { save_egid = getegid(); return (setegid(getgid())); }
}
unlink(s_un.sun_path);
s_un.sun_family = AF_UNIX;
-#ifdef SUN_LEN
s_un.sun_len = SUN_LEN(&s_un);
-#endif
omask = umask(007);
if (bind(sock, (struct sockaddr *)&s_un, sizeof(s_un))) {
return;
}
s_un.sun_family = AF_UNIX;
-#ifdef SUN_LEN
s_un.sun_len = SUN_LEN(&s_un);
-#endif
(void) signal(SIGPIPE, SIG_IGN);
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0 &&
connect(sock, (struct sockaddr *)&s_un, sizeof(s_un)) == 0)
-/* $OpenBSD: pathnames.h,v 1.15 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: pathnames.h,v 1.16 2015/10/23 18:42:55 tedu Exp $ */
/* Copyright 1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
#ifndef _PATHNAMES_H_
#define _PATHNAMES_H_
-#ifdef HAVE_PATHS_H
# include <paths.h>
-#endif /*HAVE_PATHS_H*/
#ifndef CRONDIR
/* CRONDIR is where cron(8) and crontab(1) both chdir