- if (a->q_alias == NULL && RcptLogFile != NULL &&
- !bitset(QDONTSEND, a->q_flags))
- {
- static int RcptLogFd = -1;
-
- /*
- ** Log the incoming recipient name before aliasing,
- ** expanding, forwarding, rewriting, and all that jazz.
- ** We'll use this to track down out-of-date aliases,
- ** host names, and so forth.
- */
-
- if (RcptLogFd < 0)
- {
- /* try to open the log file */
- RcptLogFd = open(RcptLogFile, O_WRONLY|O_APPEND|O_CREAT, 0666);
- if (RcptLogFd >= 0)
- (void) fcntl(RcptLogFd, F_SETFD, 1);
- }
- if (RcptLogFd >= 0)
- {
- int l = strlen(a->q_paddr);
-
- a->q_paddr[l] = '\n';
- if (write(RcptLogFd, a->q_paddr, l + 1) < 0)
- {
- (void) close(RcptLogFd);
- RcptLogFd = -1;
- }
- a->q_paddr[l] = '\0';
- }
- }
-