diff options
author | imp <imp@FreeBSD.org> | 1997-03-24 05:53:12 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-03-24 05:53:12 +0000 |
commit | 3c8c5177a0a5ca7bb746709f0bd6d78c09f72627 (patch) | |
tree | 145b01af4ba51bd6b03addacb55a2af085c4a181 /usr.sbin | |
parent | e5d10bdc2e49726df5f9f4de7b68c37c1235a234 (diff) | |
download | FreeBSD-src-3c8c5177a0a5ca7bb746709f0bd6d78c09f72627.zip FreeBSD-src-3c8c5177a0a5ca7bb746709f0bd6d78c09f72627.tar.gz |
Fix small race window when creating portal socket.
Obtained from: OpenBSD
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/mount_portalfs/mount_portalfs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/mount_portalfs/mount_portalfs.c b/usr.sbin/mount_portalfs/mount_portalfs.c index cf77264..cd8d72b 100644 --- a/usr.sbin/mount_portalfs/mount_portalfs.c +++ b/usr.sbin/mount_portalfs/mount_portalfs.c @@ -45,7 +45,7 @@ char copyright[] = static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95"; */ static const char rcsid[] = - "$Id: mount_portal.c,v 1.9 1997/02/22 14:32:53 peter Exp $"; + "$Id: mount_portal.c,v 1.10 1997/03/11 12:34:58 peter Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -110,6 +110,7 @@ main(argc, argv) int mntflags = 0; char tag[32]; struct vfsconf vfc; + mode_t um; qelem q; int rc; @@ -159,11 +160,13 @@ main(argc, argv) if (so < 0) { err(EX_OSERR, "socket"); } + um = umask(077); (void) unlink(un.sun_path); if (bind(so, (struct sockaddr *) &un, sizeof(un)) < 0) err(1, NULL); (void) unlink(un.sun_path); + (void) umask(um); (void) listen(so, 5); |