From: Eric Allman Date: Fri, 3 Sep 1993 00:45:40 +0000 (-0800) Subject: don't announce alias file rebuild if it fails X-Git-Tag: BSD-4_4_Lite1-Snapshot-Development~1836 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/9a47e53c2420cd90e485705a831dbe9befbd16f3 don't announce alias file rebuild if it fails SCCS-vsn: usr.sbin/sendmail/src/alias.c 8.13 --- diff --git a/usr/src/usr.sbin/sendmail/src/alias.c b/usr/src/usr.sbin/sendmail/src/alias.c index 3e7db12161..f25b704579 100644 --- a/usr/src/usr.sbin/sendmail/src/alias.c +++ b/usr/src/usr.sbin/sendmail/src/alias.c @@ -10,7 +10,7 @@ # include #ifndef lint -static char sccsid[] = "@(#)alias.c 8.12 (Berkeley) %G%"; +static char sccsid[] = "@(#)alias.c 8.13 (Berkeley) %G%"; #endif /* not lint */ @@ -352,20 +352,17 @@ rebuildaliases(map, automatic) if (!bitset(MCF_REBUILDABLE, map->map_class->map_cflags)) return; -#ifdef LOG - if (LogLevel > 7) - { - syslog(LOG_NOTICE, "alias database %s %srebuilt by %s", - map->map_file, automatic ? "auto" : "", username()); - } -#endif /* LOG */ - /* try to lock the source file */ if ((af = fopen(map->map_file, "r+")) == NULL) { + int saveerr = errno; + if (tTd(27, 1)) printf("Can't open %s: %s\n", - map->map_file, errstring(errno)); + map->map_file, errstring(saveerr)); + if (!automatic) + message("newaliases: cannot open %s: %s", + map->map_file, errstring(saveerr)); errno = 0; return; } @@ -391,6 +388,14 @@ rebuildaliases(map, automatic) if (map->map_class->map_open(map, O_RDWR)) { +#ifdef LOG + if (LogLevel > 7) + { + syslog(LOG_NOTICE, "alias database %s %srebuilt by %s", + map->map_file, automatic ? "auto" : "", + username()); + } +#endif /* LOG */ map->map_mflags |= MF_OPEN|MF_WRITABLE; readaliases(map, af, automatic); }