SCCS-vsn: usr.sbin/timed/timed/timed.c 2.7
- * Copyright (c) 1983 Regents of the University of California.
+ * Copyright (c) 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef lint
char copyright[] =
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef lint
char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
+"@(#) Copyright (c) 1985 Regents of the University of California.\n\
All rights reserved.\n";
#endif not lint
#ifndef lint
All rights reserved.\n";
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)timed.c 2.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)timed.c 2.7 (Berkeley) %G%";
#endif not lint
#include "globals.h"
#endif not lint
#include "globals.h"
-#ifndef DEBUG
- if (fork())
- exit(0);
- { int s;
- for (s = getdtablesize(); s >= 0; --s)
- (void) close(s);
- (void) open("/dev/null", 0);
- (void) dup2(0, 1);
- (void) dup2(0, 2);
- s = open("/dev/tty", 2);
- if (s >= 0) {
- (void) ioctl(s, (int)TIOCNOTTY, (char *)0);
- (void) close(s);
- }
- }
-#endif
-
if (trace == ON) {
fd = fopen(tracefile, "w");
setlinebuf(fd);
if (trace == ON) {
fd = fopen(tracefile, "w");
setlinebuf(fd);
/* election timer delay in secs. */
delay2 = casual((long)MINTOUT, (long)MAXTOUT);
/* election timer delay in secs. */
delay2 = casual((long)MINTOUT, (long)MAXTOUT);
+#ifndef DEBUG
+ if (fork())
+ exit(0);
+ { int s;
+ for (s = getdtablesize(); s >= 0; --s)
+ (void) close(s);
+ (void) open("/dev/null", 0);
+ (void) dup2(0, 1);
+ (void) dup2(0, 2);
+ s = open("/dev/tty", 2);
+ if (s >= 0) {
+ (void) ioctl(s, (int)TIOCNOTTY, (char *)0);
+ (void) close(s);
+ }
+ }
+#endif
+
if (Mflag) {
/* open raw socket used to measure time differences */
if (Mflag) {
/* open raw socket used to measure time differences */
} else {
/* if Mflag is not set timedaemon is forced to act as a slave */
status = SLAVE;
} else {
/* if Mflag is not set timedaemon is forced to act as a slave */
status = SLAVE;
- makeslave(firstslavenet());
if (setjmp(jmpenv)) {
setstatus();
checkignorednets();
if (setjmp(jmpenv)) {
setstatus();
checkignorednets();
- makeslave(firstslavenet());
+ makeslave(firstslavenet());
for (ntp = nettab; ntp != NULL; ntp = ntp->next)
if (ntp->status == MASTER)
ntp->status = IGNORE;
for (ntp = nettab; ntp != NULL; ntp = ntp->next)
if (ntp->status == MASTER)
ntp->status = IGNORE;
return ((struct netinfo *)0);
}
return ((struct netinfo *)0);
}
* `casual' returns a random number in the range [inf, sup]
*/
* `casual' returns a random number in the range [inf, sup]
*/