diff options
Diffstat (limited to 'usr.bin/cvs/sock.c')
-rw-r--r-- | usr.bin/cvs/sock.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/cvs/sock.c b/usr.bin/cvs/sock.c index 7415f18e925..7c948fe1f66 100644 --- a/usr.bin/cvs/sock.c +++ b/usr.bin/cvs/sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.4 2004/08/02 17:34:10 jfb Exp $ */ +/* $OpenBSD: sock.c,v 1.5 2004/09/24 14:28:07 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -93,7 +93,15 @@ cvsd_sock_open(void) return (-1); } - listen(cvsd_sock, 10); + (void)listen(cvsd_sock, 10); + + if (chown(cvsd_sock_path, getuid(), cvsd_gid) == -1) { + cvs_log(LP_ERRNO, "failed to change owner of `%s'", + cvsd_sock_path); + (void)close(cvsd_sock); + (void)unlink(cvsd_sock_path); + return (-1); + } if (chmod(cvsd_sock_path, CVSD_SOCK_PERMS) == -1) { cvs_log(LP_ERRNO, "failed to change mode of `%s'", |