struct sigaction sa;
struct stat stb;
- if (fstat(0, &stb) < 0) {
- /* Open standard input, output & error. */
- (void) open("/dev/null", O_RDONLY);
- (void) open("/dev/log", O_WRONLY);
- dup(1);
+#define OPENFDS \
+ if (fstat(0, &stb) < 0) { \
+ /* Open standard input, output & error. */ \
+ (void) open("/dev/null", O_RDONLY); \
+ (void) open("/dev/log", O_WRONLY); \
+ dup(1); \
}
sigemptyset(&sa.sa_mask);
_exit(1); /* impossible, we hope */
}
+ OPENFDS;
+
/* Clear /etc/utmp if it exists. */
if ((fd = open(PATH_UTMP, O_WRONLY | O_TRUNC)) >= 0) close(fd);