*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$Id: crontab.c,v 1.2 1996/08/07 06:18:09 deraadt Exp $";
+static char rcsid[] = "$Id: crontab.c,v 1.3 1996/09/15 10:02:34 deraadt Exp $";
#endif
/* crontab - install and manage per-user crontab files
time_t mtime;
WAIT_T waiter;
PID_T pid, xpid;
+ mode_t um;
log_it(RealUser, Pid, "BEGIN EDIT", User);
(void) sprintf(n, CRON_TAB(User));
}
}
- (void) sprintf(Filename, "/tmp/crontab.%d", Pid);
- if (-1 == (t = open(Filename, O_CREAT|O_EXCL|O_RDWR, 0600))) {
+ um = umask(0600);
+ (void) sprintf(Filename, "/tmp/crontab.XXXXXXXX");
+ if ((t = mkstemp(Filename)) == -1) {
perror(Filename);
+ (void) umask(um);
goto fatal;
}
+ (void) umask(um);
#ifdef HAS_FCHOWN
if (fchown(t, getuid(), getgid()) < 0) {
#else