The problem is that fopen(tty, "w") uses O_CREAT.  If we use open
+ fdopen we can avoid that.

Can you try this diff?

 - todd

Index: libexec/comsat/comsat.c
===================================================================
RCS file: /cvs/src/libexec/comsat/comsat.c,v
retrieving revision 1.44
diff -u -p -u -r1.44 comsat.c
--- libexec/comsat/comsat.c     12 Oct 2015 16:54:30 -0000      1.44
+++ libexec/comsat/comsat.c     1 Apr 2016 22:19:13 -0000
@@ -234,6 +234,7 @@ static char *cr;
 void
 notify(struct utmp *utp, off_t offset)
 {
+       int fd;
        FILE *tp;
        struct stat stb;
        struct termios ttybuf;
@@ -257,7 +258,8 @@ notify(struct utmp *utp, off_t offset)
                return;
        (void)signal(SIGALRM, SIG_DFL);
        (void)alarm(30);
-       if ((tp = fopen(tty, "w")) == NULL) {
+       fd = open(tty, O_WRONLY);
+       if (fd == -1 || (tp = fdopen(fd, "w")) == NULL) {
                dsyslog(LOG_ERR, "%s: %s", tty, strerror(errno));
                _exit(1);
        }

Reply via email to