forked from vixie/cron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svcrontab.c
691 lines (639 loc) · 18.2 KB
/
svcrontab.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
/*
* Copyright (c) 1988,1990,1993,1994,2021 by Paul Vixie ("VIXIE")
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIXIE DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIXIE BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* crontab - install and manage per-user crontab files
*/
#define MAIN_PROGRAM
#include <stralloc.h>
#include <qprintf.h>
#include <subfd.h>
#include <strerr.h>
#include <fmt.h>
#include <setuserid.h>
#include <getln.h>
#include "cron.h"
#if !defined(lint) && !defined(LINT)
static char rcsid[] = "$Id: svcrontab.c,v 1.1 2024-06-09 01:04:28+05:30 Cprogrammer Exp mbhangui $";
#endif
#define FATAL "svcrontab: fatal: "
#define WARN "svcrontab: warn: "
#define NHEADER_LINES 3
enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace, opt_service };
static char *getoptargs = "u:lerd:";
static pid_t Pid;
static char *User, *spool_dir = SPOOL_DIR;
stralloc realuser = {0};
stralloc Filename = {0}, TempFilename = {0}, line = {0};
static FILE *NewCrontab;
static int CheckErrorCount;
static enum opt_t Option;
static struct passwd *pw;
stralloc n = {0}, q = {0};
static void list_cmd(void);
static void delete_cmd(void);
static void edit_cmd(void);
static void poke_daemon(void);
static void check_error(const char *);
static void parse_args(int c, char *v[], char **);
static void die(int);
static int replace_cmd(void);
static void
usage(const char *msg)
{
subprintf(subfderr, "%s: usage error: %s\n", ProgramName, msg);
subprintf(subfderr, "usage:\t%s [-u user] file\n", ProgramName);
subprintf(subfderr, "\t%s [-u user] [ -e | -l | -r ]\n", ProgramName);
subprintf(subfderr, "\t\t(default operation is replace, per 1003.2)\n");
subprintf(subfderr, "\t-e\t(edit user's crontab)\n");
subprintf(subfderr, "\t-l\t(list user's crontab)\n");
subprintf(subfderr, "\t-r\t(delete user's crontab)\n");
substdio_flush(subfderr);
_exit(100);
}
int
main(int argc, char *argv[])
{
int exitstatus;
char *svdir = NULL;
Pid = getpid();
ProgramName = "svcrontab";
setlocale(LC_ALL, "");
parse_args(argc, argv, &svdir); /* sets many globals, opens a file */
if (!svdir) {
set_cron_cwd(FATAL);
if (!allowed(realuser.s, CRON_ALLOW, CRON_DENY)) {
subprintf(subfderr, "You (%s) are not allowed to use this program (%s)\n", User, ProgramName);
subprintf(subfderr, "See crontab(1) for more information\n");
log_it2(realuser.s, Pid, "AUTH", "crontab command not allowed");
substdio_flush(subfderr);
_exit(111);
}
}
if (svdir && chdir(svdir) == -1)
strerr_die4sys(111, FATAL, "chdir: ", svdir, ": ");
exitstatus = OK_EXIT;
switch (Option)
{
case opt_unknown:
exitstatus = ERROR_EXIT;
break;
case opt_list:
list_cmd();
break;
case opt_delete:
delete_cmd();
break;
case opt_edit:
edit_cmd();
break;
case opt_replace:
if (replace_cmd() < 0)
exitstatus = ERROR_EXIT;
break;
default:
abort();
}
_exit(exitstatus);
/* NOTREACHED*/
}
static void
parse_args(int argc, char *argv[], char **svdir)
{
int argch;
struct stat sb;
*svdir = NULL;
if (!(pw = getpwuid(getuid()))) {
subprintf(subfderr, "%s: your UID isn't in the passwd file.\n", ProgramName);
subprintf(subfderr, "bailing out.\n");
substdio_flush(subfderr);
_exit(100);
}
User = pw->pw_name;
if (!stralloc_copys(&realuser, User) ||
!stralloc_0(&realuser))
die_nomem(FATAL);
Filename.len = 0;
Option = opt_unknown;
while (-1 != (argch = getopt(argc, argv, getoptargs))) {
switch (argch)
{
case 'd': /*- this overrides set_cron_cwd */
*svdir = optarg;
spool_dir = optarg;
if (getuid() != geteuid()) { /* running as setuid */
if (setgid(MY_GID(pw)) < 0)
strerr_die3sys(111, "setgid: ", pw->pw_name, ": ");
else
if (setuid(MY_UID(pw)) < 0)
strerr_die3sys(111, "setuid: ", pw->pw_name, ": ");
}
break;
case 'u':
if (MY_UID(pw) != ROOT_UID) {
subprintf(subfderr, "must be privileged to use -u\n");
substdio_flush(subfderr);
_exit(100);
}
if (!(pw = getpwnam(optarg))) {
subprintf(subfderr, "%s: user `%s' unknown\n", ProgramName, optarg);
substdio_flush(subfderr);
_exit(100);
}
User = optarg;
break;
case 'l':
if (Option != opt_unknown)
usage("only one operation permitted");
Option = opt_list;
break;
case 'r':
if (Option != opt_unknown)
usage("only one operation permitted");
Option = opt_delete;
break;
case 'e':
if (Option != opt_unknown)
usage("only one operation permitted");
Option = opt_edit;
break;
default:
usage("unrecognized option");
}
}
endpwent();
if (Option != opt_unknown) {
if (argv[optind] != NULL)
usage("no arguments permitted after this option");
} else {
if (argv[optind] != NULL) {
Option = opt_replace;
if (!stralloc_copys(&Filename, argv[optind]) ||
!stralloc_0(&Filename))
die_nomem(FATAL);
} else
usage("file name must be specified for replace");
}
if (Option == opt_replace) {
/*
* we have to open the file here because we're going to
* chdir(2) into /etc/indimail/cron before we get around to
* reading the file.
*/
if (!strcmp(Filename.s, "-"))
NewCrontab = stdin;
else {
/*
* relinquish the setuid status of the binary during
* the open, lest nonroot users read files they should
* not be able to read. we can't use access() here
* since there's a race condition. thanks go out to
* Arnt Gulbrandsen <[email protected]> for spotting
* the race.
*/
if (swap_uids() < OK)
strerr_die2sys(111, FATAL, "set uid/gid: ");
if (!(NewCrontab = fopen(Filename.s, "r")))
strerr_die3sys(111, "open ", Filename.s, ": ");
if (fstat(fileno(NewCrontab), &sb) < 0)
strerr_die3sys(111, "unable to stat ", Filename.s, ": ");
if ((sb.st_mode & S_IFMT) == S_IFDIR)
strerr_die4sys(100, FATAL, "invalid crontab file: ", Filename.s, "is a directory");
if (swap_uids_back() < OK)
strerr_die2sys(111, FATAL, "restore uid/gid: ");
}
}
}
void
myglue_string(stralloc *s, char *s1, char *sep, char *s2)
{
if (!stralloc_copys(s, s1) ||
!stralloc_append(s, sep) ||
!stralloc_cats(s, s2) ||
!stralloc_0(s))
die_nomem(FATAL);
return;
}
static void
list_cmd(void)
{
FILE *f;
int ch;
log_it2(realuser.s, Pid, "LIST", User);
myglue_string(&n, spool_dir, "/", User);
if (!(f = fopen(n.s, "r"))) {
if (errno == ENOENT) {
subprintf(subfderr, "no crontab for %s\n", User);
substdio_flush(subfderr);
} else
strerr_die4sys(111, FATAL, "error opening file ", n.s, ": ");
}
/*- file is open. copy to stdout, close. */
Set_LineNum(1)
while (EOF != (ch = get_char(f)))
putchar(ch);
fclose(f);
}
static void
delete_cmd(void)
{
log_it2(realuser.s, Pid, "DELETE", User);
myglue_string(&n, spool_dir, "/", User);
if (unlink(n.s) == -1) {
if (errno == ENOENT) {
subprintf(subfderr, "no crontab for %s\n", User);
substdio_flush(subfderr);
} else
strerr_die4sys(111, FATAL, "error opening file ", n.s, ": ");
}
poke_daemon();
}
static void
check_error(const char *msg)
{
CheckErrorCount++;
subprintf(subfderr, "\"%s\":%d: %s\n", Filename.s, LineNumber - 1, msg);
substdio_flush(subfderr);
}
static void
edit_cmd(void)
{
char *editor;
FILE *f;
int ch, t, x, waiter, match;
struct stat statbuf;
struct utimbuf utimebuf;
pid_t pid, xpid;
char strnum1[FMT_ULONG], strnum2[FMT_ULONG];
log_it2(realuser.s, Pid, "BEGIN EDIT", User);
myglue_string(&n, spool_dir, "/", User);
if (!(f = fopen(n.s, "r"))) {
if (errno != ENOENT)
strerr_die4sys(111, FATAL, "error opening file ", n.s, ": ");
subprintf(subfderr, "no crontab for %s - using an empty one\n", User);
substdio_flush(subfderr);
if (!(f = fopen(_PATH_DEVNULL, "r")))
strerr_die2sys(111, FATAL, "error opening /dev/null: ");
}
if (fstat(fileno(f), &statbuf) < 0)
strerr_die4sys(111, FATAL, "stat: ", n.s, ": ");
utimebuf.actime = statbuf.st_atime;
utimebuf.modtime = statbuf.st_mtime;
/*- Turn off signals. */
(void) signal(SIGHUP, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
(void) signal(SIGQUIT, SIG_IGN);
if (!stralloc_copys(&Filename, _PATH_TMP))
die_nomem(FATAL);
if (Filename.s[Filename.len - 1] == '/')
Filename.len--;
if (!stralloc_catb(&Filename, "/crontab.XXXXXXXXXX", 19) ||
!stralloc_0(&Filename))
die_nomem(FATAL);
if (-1 == (t = mkstemp(Filename.s))) {
strerr_warn4(WARN, "mkstemp: ", Filename.s, ": ", &strerr_sys);
goto fatal;
}
if (!getuid() || getuid() != geteuid()) { /* running as root or setuid */
#ifdef HAVE_FCHOWN
if (fchown(t, MY_UID(pw), MY_GID(pw)) < 0) {
strnum1[fmt_ushort(strnum1, pw->pw_uid)] = 0;
strnum2[fmt_ushort(strnum2, pw->pw_uid)] = 0;
strerr_warn8(WARN, "fchown: ", strnum1, ":", strnum2, " ", Filename.s, ": ", &strerr_sys);
goto fatal;
}
#else
if (chown(Filename.s, MY_UID(pw), MY_GID(pw)) < 0) {
strnum1[fmt_short(strnum1, pw->pw_uid)] = 0;
strnum2[fmt_short(strnum2, pw->pw_uid)] = 0;
strerr_warn8(WARN, "chown: ", strnum1, ":", strnum2, " ", Filename.s, ": ", &strerr_sys);
goto fatal;
}
#endif
}
if (!(NewCrontab = fdopen(t, "r+"))) {
strerr_warn2(WARN, "mkstemp: crontab.XXXXXXXXXX: ", &strerr_sys);
goto fatal;
}
Set_LineNum(1)
/*- ignore the top few comments since we probably put them there. */
x = 0;
while (EOF != (ch = get_char(f))) {
if ('#' != ch) {
putc(ch, NewCrontab);
break;
}
while (EOF != (ch = get_char(f)))
if (ch == '\n')
break;
if (++x >= NHEADER_LINES)
break;
}
/*- copy the rest of the crontab (if any) to the temp file. */
if (EOF != ch)
while (EOF != (ch = get_char(f)))
putc(ch, NewCrontab);
fclose(f);
if (fflush(NewCrontab) < OK)
strerr_die4sys(111, WARN, "flush: ", Filename.s, ": ");
if (utime(Filename.s, &utimebuf) == -1)
strerr_die4sys(111, WARN, "utime: ", Filename.s, ": ");
again:
rewind(NewCrontab);
if (ferror(NewCrontab)) {
subprintf(subfderr, "%s: error while writing new crontab to %s: %s\n", ProgramName, Filename, strerror(errno));
substdio_flush(subfderr);
fatal:
unlink(Filename.s);
_exit(111);
}
if (((editor = getenv("VISUAL")) == NULL || *editor == '\0') && ((editor = getenv("EDITOR")) == NULL || *editor == '\0')) {
editor = EDITOR;
}
/*
* we still have the file open. editors will generally rewrite the
* original file rather than renaming/unlinking it and starting a
* new one; even backup files are supposed to be made by copying
* rather than by renaming. if some editor does not support this,
* then don't use it. the security problems are more severe if we
* close and reopen the file around the edit.
*/
switch (pid = fork())
{
case -1:
strerr_die2sys(111, FATAL, "unable to produce a child: ");
goto fatal;
case 0:
/* child */
if (setgid(MY_GID(pw)) < 0)
strerr_die3sys(111, "setgid: ", pw->pw_name, ": ");
if (setuid(MY_UID(pw)) < 0)
strerr_die3sys(111, "setuid: ", pw->pw_name, ": ");
if (chdir(_PATH_TMP) < 0)
strerr_die3sys(111, "chdir: ", _PATH_TMP, ": ");
myglue_string(&q, editor, " ", Filename.s);
execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", q.s, (char *) 0);
strerr_die3sys(111, FATAL, q.s, ": ");
/* NOTREACHED*/
default:
break;
}
/*- parent */
for (;;) {
xpid = waitpid(pid, &waiter, WUNTRACED);
if (xpid == -1) {
if (errno != EINTR) {
subprintf(subfderr, "%s: waitpid() failed waiting for PID %ld from \"%s\": %s\n", ProgramName, (long) pid, editor,
strerror(errno));
substdio_flush(subfderr);
}
} else
if (xpid != pid) {
subprintf(subfderr, "%s: wrong PID (%ld != %ld) from \"%s\"\n", ProgramName, (long) xpid, (long) pid, editor);
substdio_flush(subfderr);
goto fatal;
} else
if (WIFSTOPPED(waiter)) {
kill(getpid(), WSTOPSIG(waiter));
} else
if (WIFEXITED(waiter) && WEXITSTATUS(waiter)) {
subprintf(subfderr, "%s: \"%s\" exited with status %d\n", ProgramName, editor, WEXITSTATUS(waiter));
substdio_flush(subfderr);
goto fatal;
} else
if (WIFSIGNALED(waiter)) {
subprintf(subfderr, "%s: \"%s\" killed; signal %d (%score dumped)\n", ProgramName, editor, WTERMSIG(waiter),
WCOREDUMP(waiter) ? "" : "no ");
substdio_flush(subfderr);
goto fatal;
} else
break;
}
(void) signal(SIGHUP, SIG_DFL);
(void) signal(SIGINT, SIG_DFL);
(void) signal(SIGQUIT, SIG_DFL);
if (fstat(t, &statbuf) < 0) {
strerr_warn4(WARN, "unable to stat ", Filename.s, ": ", &strerr_sys);
goto fatal;
}
if (utimebuf.modtime == statbuf.st_mtime) {
strerr_warn2(WARN, "no changes made to crontab", 0);
goto remove;
}
strerr_warn2(ProgramName, ": installing new crontab", 0);
switch (replace_cmd())
{
case 0:
break;
case -1:
for (;;) {
printf("Do you want to retry the same edit? ");
fflush(stdout);
if (getln(subfdinsmall, &line, &match, '\n') == -1)
strerr_die2sys(111, FATAL, "unable to read input: ");
if (!line.len)
strerr_die2sys(111, FATAL, "unable to read input: ");
switch (line.s[0])
{
case 'y':
case 'Y':
goto again;
case 'n':
case 'N':
goto abandon;
default:
substdio_puts(subfderr, "Enter Y or N - ");
substdio_flush(subfderr);
}
}
/*- NOTREACHED */
case -2:
abandon:
strerr_warn3(WARN, "edits left in ", Filename.s, 0);
goto done;
default:
strerr_warn2(WARN, "panic: bad switch() in replace_cmd()", 0);
goto fatal;
}
remove:
unlink(Filename.s);
done:
log_it2(realuser.s, Pid, "END EDIT", User);
}
/*
* returns 0 on success
* * -1 on syntax error
* * -2 on install error
*/
static int
replace_cmd(void)
{
FILE *tmp;
int ch, eof, fd, error = 0;
entry *e;
uid_t file_uid;
time_t now = time(NULL);
char strnum[FMT_ULONG];
char *envstr;
char **envp = myenv_init();
if (envp == NULL)
die_nomem(FATAL);
myglue_string(&TempFilename, spool_dir, "/", "tmp.XXXXXXXXXX");
if ((fd = mkstemp(TempFilename.s)) == -1 || !(tmp = fdopen(fd, "w+"))) {
strerr_warn4(WARN, "mkstemp: ", TempFilename.s, ": ", &strerr_sys);
if (fd != -1) {
close(fd);
unlink(TempFilename.s);
}
TempFilename.len = 0;
return (-2);
}
(void) signal(SIGHUP, die);
(void) signal(SIGINT, die);
(void) signal(SIGQUIT, die);
/*
* write a signature at the top of the file.
*
* VERY IMPORTANT: make sure NHEADER_LINES agrees with this code.
*/
fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n");
fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename.s, ctime(&now));
fprintf(tmp, "# (svcron version %s -- %s)\n", CRON_VERSION, rcsid);
/*- copy the crontab to the tmp */
rewind(NewCrontab);
Set_LineNum(1)
while (EOF != (ch = get_char(NewCrontab)))
putc(ch, tmp);
if (ftruncate(fileno(tmp), ftell(tmp)) == -1) { /* XXX redundant with "w+"? */
strerr_warn4(WARN, "error while truncating new crontab ", TempFilename.s, ": ", &strerr_sys);
}
fflush(tmp);
rewind(tmp);
if (ferror(tmp)) {
strerr_warn4(WARN, "error while writing new crontab to ", TempFilename.s, ": ", &strerr_sys);
fclose(tmp);
error = -2;
goto done;
}
/*- check the syntax of the file being installed. */
/*
* BUG: was reporting errors after the EOF if there were any errors
* in the file proper -- kludged it by stopping after first error.
* vix 31mar87
*/
Set_LineNum(1 - NHEADER_LINES)
CheckErrorCount = 0;
eof = FALSE;
while (!CheckErrorCount && !eof) {
switch (load_env(&envstr, tmp))
{
case ERR:
/*- check for data before the EOF */
if (envstr && *envstr) {
Set_LineNum(LineNumber + 1)
check_error("premature EOF");
}
eof = TRUE;
break;
case FALSE:
e = load_entry(tmp, check_error, pw, envp);
if (e)
free(e);
break;
case TRUE:
break;
}
}
if (CheckErrorCount != 0) {
strerr_warn2(WARN, "errors in crontab file, can't install.", 0);
fclose(tmp);
error = -1;
goto done;
}
file_uid = (getuid() == geteuid()) ? ROOT_UID : pw->pw_uid;
if (!getuid() || getuid() != geteuid()) { /* running as root or setuid */
#ifdef HAVE_FCHOWN
if (fchown(fileno(tmp), file_uid, -1) < OK) {
strnum[fmt_ushort(strnum, file_uid)] = 0;
strerr_warn4(WARN, "fchown ", strnum, ": ", &strerr_sys);
fclose(tmp);
error = -2;
goto done;
}
#else
if (chown(TempFilename, file_uid, -1) < OK) {
strnum[fmt_ushort(strnum, file_uid)] = 0;
strerr_warn4(WARN, "chown ", strnum, ": ", &strerr_sys);
fclose(tmp);
error = -2;
goto done;
}
#endif
}
if (fclose(tmp) == EOF) {
strerr_warn4(WARN, "unable to save ", TempFilename.s, ": ", &strerr_sys);
error = -2;
goto done;
}
myglue_string(&n, spool_dir, "/", User);
if (rename(TempFilename.s, n.s)) {
strerr_warn6(WARN, "error renaming ", ProgramName, " to ", TempFilename.s, ": ", &strerr_sys);
error = -2;
goto done;
}
TempFilename.len = 0;
log_it2(realuser.s, Pid, "REPLACE", User);
poke_daemon();
done:
(void) signal(SIGHUP, SIG_DFL);
(void) signal(SIGINT, SIG_DFL);
(void) signal(SIGQUIT, SIG_DFL);
if (TempFilename.len) {
if (unlink(TempFilename.s) == -1)
strerr_warn4(WARN, "unlink: ", TempFilename.s, ": ", &strerr_sys);
TempFilename.len = 0;
}
return (error);
}
static void
poke_daemon(void)
{
if (utime(spool_dir, NULL) < OK) {
strerr_warn5(WARN, ProgramName, ": can't update mtime on ", spool_dir, ": ", &strerr_sys);
return;
}
}
static void
die(int x)
{
if (TempFilename.len)
if (unlink(TempFilename.s) == -1)
strerr_warn4(WARN, "unlink: ", TempFilename.s, ": ", &strerr_sys);
_exit(111);
}
void
getversion_crontab_c()
{
const char *x = rcsid;
x++;
}
/*-
* $Log: svcrontab.c,v $
* Revision 1.1 2024-06-09 01:04:28+05:30 Cprogrammer
* Initial revision
*
*/