summaryrefslogtreecommitdiffstats
path: root/libexec/talkd
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2004-03-10 03:45:24 +0000
committertedu <tedu@openbsd.org>2004-03-10 03:45:24 +0000
commitec6c8ee6d0c5f606b6cb6e24e1fc38b22a7425f9 (patch)
treee678c24ad10c771364445ed5ccc39012e5f00c2c /libexec/talkd
parentDocument SCSIFORCELUN_* options. (diff)
downloadwireguard-openbsd-ec6c8ee6d0c5f606b6cb6e24e1fc38b22a7425f9.tar.xz
wireguard-openbsd-ec6c8ee6d0c5f606b6cb6e24e1fc38b22a7425f9.zip
close file on error paths. from Patrick Latifi
Diffstat (limited to 'libexec/talkd')
-rw-r--r--libexec/talkd/announce.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index 52de9a1c353..afb8124a6ee 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: announce.c,v 1.18 2003/06/11 14:24:46 deraadt Exp $ */
+/* $OpenBSD: announce.c,v 1.19 2004/03/10 03:45:24 tedu Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -31,7 +31,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)announce.c 5.9 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: announce.c,v 1.18 2003/06/11 14:24:46 deraadt Exp $";
+static char rcsid[] = "$Id: announce.c,v 1.19 2004/03/10 03:45:24 tedu Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -70,10 +70,14 @@ announce(CTL_MSG *request, char *remote_machine)
return (FAILED);
if ((tf = fopen(full_tty, "w")) == NULL)
return (PERMISSION_DENIED);
- if (fstat(fileno(tf), &stbuf) < 0)
+ if (fstat(fileno(tf), &stbuf) < 0) {
+ fclose(tf);
return (PERMISSION_DENIED);
- if ((stbuf.st_mode&S_IWGRP) == 0)
+ }
+ if ((stbuf.st_mode & S_IWGRP) == 0) {
+ fclose(tf);
return (PERMISSION_DENIED);
+ }
print_mesg(tf, request, remote_machine);
fclose(tf);
return (SUCCESS);