FreeBSD Bugzilla – Attachment 8258 Details for
Bug 17363
[patch] crontab(1) leaves files in /var/cron/tabs when interrupted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.08 KB, created by
adrian
on 2000-03-13 20:50:02 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
adrian
Created:
2000-03-13 20:50:02 UTC
Size:
1.08 KB
patch
obsolete
>--- crontab.c.orig Mon Mar 13 14:22:40 2000 >+++ crontab.c Mon Mar 13 15:39:03 2000 >@@ -452,6 +452,17 @@ > } > > >+static char *_tmp_path = 0; >+void >+static remove_tmp(int sig) >+{ >+ if (_tmp_path) { >+ unlink(_tmp_path); >+ } >+ exit(ERROR_EXIT); >+} >+ >+ > /* returns 0 on success > * -1 on syntax error > * -2 on install error >@@ -464,6 +475,7 @@ > entry *e; > time_t now = time(NULL); > char **envp = env_init(); >+ void (*f[4])(); > > if (envp == NULL) { > warnx("cannot allocate memory"); >@@ -472,6 +484,13 @@ > > (void) sprintf(n, "tmp.%d", Pid); > (void) sprintf(tn, CRON_TAB(n)); >+ >+ /* Set up to remove the temp file if interrupted by a signal. */ >+ f[0] = signal(SIGHUP, remove_tmp); >+ f[1] = signal(SIGINT, remove_tmp); >+ f[2] = signal(SIGTERM, remove_tmp); >+ _tmp_path = tn; >+ > if (!(tmp = fopen(tn, "w+"))) { > warn("%s", tn); > return (-2); >@@ -564,6 +583,13 @@ > unlink(tn); > return (-2); > } >+ >+ /* Restore the default signal handlers. */ >+ _tmp_path = 0; >+ signal(SIGHUP, f[0]); >+ signal(SIGINT, f[1]); >+ signal(SIGTERM, f[2]); >+ > log_it(RealUser, Pid, "REPLACE", User); > > poke_daemon();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 17363
: 8258