summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-09-24 15:51:08 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-09-24 15:51:08 +0000
commita93b3be28a2f427d2d19a775af6045860edfcf48 (patch)
treebb6b23fc9e0e32eb3bb7f1c284b3646aa37cf1c7 /usr.bin/cvs
parentd8a992dd20d3f2457946e5ca6a39ad42082087cd (diff)
Before attempting to unlink() the local socket, set the effective
UID to 0 so we have the appropriate permissions to perform the operation
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/sock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/cvs/sock.c b/usr.bin/cvs/sock.c
index 7c948fe1f66..e543e0154f5 100644
--- a/usr.bin/cvs/sock.c
+++ b/usr.bin/cvs/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.5 2004/09/24 14:28:07 jfb Exp $ */
+/* $OpenBSD: sock.c,v 1.6 2004/09/24 15:51:07 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -130,7 +130,9 @@ cvsd_sock_close(void)
if (close(cvsd_sock) == -1) {
cvs_log(LP_ERRNO, "failed to close local socket");
}
- if (unlink(cvsd_sock_path) == -1)
+ if (seteuid(0) == -1)
+ cvs_log(LP_ERRNO, "failed to regain privileges");
+ else if (unlink(cvsd_sock_path) == -1)
cvs_log(LP_ERRNO, "failed to unlink local socket `%s'",
cvsd_sock_path);
}