aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDavid Nugent <davidn@FreeBSD.org>1997-02-18 05:47:07 +0000
committerDavid Nugent <davidn@FreeBSD.org>1997-02-18 05:47:07 +0000
commita88368cfdf5c8e01d6ba9e9b06bd326399cc60a8 (patch)
tree858311c19c41707f8b4484a7302b9264a646222d /usr.bin
parent25ed2ac22308ac3cf99f84c49f484e67f1967555 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/at/at.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 6930ae8ddb4cc..437ee5a09cc8f 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <sys/param.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -45,12 +46,19 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <utmp.h>
#ifndef __FreeBSD__
#include <getopt.h>
#else
#include <locale.h>
#endif
+#if (MAXLOGNAME-1) > UT_NAMESIZE
+#define LOGNAMESIZE UT_NAMESIZE
+#else
+#define LOGNAMESIZE (MAXLOGNAME-1)
+#endif
+
/* Local headers */
#include "at.h"
@@ -306,7 +314,7 @@ writefile(time_t runtimer, char queue)
mailname = getenv("LOGNAME");
if ((mailname == NULL) || (mailname[0] == '\0')
- || (strlen(mailname) > 8) || (getpwnam(mailname)==NULL))
+ || (strlen(mailname) > LOGNAMESIZE) || (getpwnam(mailname)==NULL))
{
pass_entry = getpwuid(real_uid);
if (pass_entry != NULL)
@@ -319,8 +327,8 @@ writefile(time_t runtimer, char queue)
if (fpin == NULL)
perr("Cannot open input file");
}
- fprintf(fp, "#!/bin/sh\n# atrun uid=%ld gid=%ld\n# mail %8s %d\n",
- (long) real_uid, (long) real_gid, mailname, send_mail);
+ fprintf(fp, "#!/bin/sh\n# atrun uid=%ld gid=%ld\n# mail %*s %d\n",
+ (long) real_uid, (long) real_gid, LOGNAMESIZE, mailname, send_mail);
/* Write out the umask at the time of invocation
*/