aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/at
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2002-07-22 11:32:16 +0000
committerRobert Drehmel <robert@FreeBSD.org>2002-07-22 11:32:16 +0000
commit6d6c6baac48e9fec4c1237061c16d077f08181be (patch)
treec20456c4105f6def1a70437831bde6b4a1883739 /usr.bin/at
parentdad7ed015cee4be1319c5715113b8ec57861fd75 (diff)
downloadsrc-6d6c6baac48e9fec4c1237061c16d077f08181be.tar.gz
src-6d6c6baac48e9fec4c1237061c16d077f08181be.zip
- Use MAXLOGNAME - 1 instead of UT_NAMESIZE.
- Do not pretend there is something like '/etc/utmp'.
Notes
Notes: svn path=/head/; revision=100494
Diffstat (limited to 'usr.bin/at')
-rw-r--r--usr.bin/at/at.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 6756839b2f20..3eb3e740f7e4 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -56,13 +56,6 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
-
-#if (MAXLOGNAME-1) > UT_NAMESIZE
-#define LOGNAMESIZE UT_NAMESIZE
-#else
-#define LOGNAMESIZE (MAXLOGNAME-1)
-#endif
/* Local headers */
@@ -320,15 +313,15 @@ writefile(time_t runtimer, char queue)
if((fp = fdopen(fdes, "w")) == NULL)
panic("cannot reopen atjob file");
- /* Get the userid to mail to, first by trying getlogin(), which reads
- * /etc/utmp, then from LOGNAME, finally from getpwuid().
+ /* Get the userid to mail to, first by trying getlogin(),
+ * then from LOGNAME, finally from getpwuid().
*/
mailname = getlogin();
if (mailname == NULL)
mailname = getenv("LOGNAME");
if ((mailname == NULL) || (mailname[0] == '\0')
- || (strlen(mailname) > LOGNAMESIZE) || (getpwnam(mailname)==NULL))
+ || (strlen(mailname) >= MAXLOGNAME) || (getpwnam(mailname)==NULL))
{
pass_entry = getpwuid(real_uid);
if (pass_entry != NULL)
@@ -342,7 +335,8 @@ writefile(time_t runtimer, char queue)
perr("cannot open input file");
}
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);
+ (long) real_uid, (long) real_gid, MAXLOGNAME - 1, mailname,
+ send_mail);
/* Write out the umask at the time of invocation
*/