summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/server.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-01-29 01:35:06 +0000
committerbrian <brian@FreeBSD.org>2001-01-29 01:35:06 +0000
commita814a5c65302a3e23434ad3b038e8067f0162df9 (patch)
tree289e5d91b5f2196492ecc29311ba656cd44c5cb1 /usr.sbin/ppp/server.c
parent5728ea1f1d0346a88fd4dd9f320ddf922cd13dad (diff)
downloadFreeBSD-src-a814a5c65302a3e23434ad3b038e8067f0162df9.zip
FreeBSD-src-a814a5c65302a3e23434ad3b038e8067f0162df9.tar.gz
Only remove socket files with ``set server open''.
Only show the mask in ``show bundle'' when it's been specified. Complain about unexpected arguments after ``set server {none,open,closed}'' Log re-open failures as warnings rather than phase messages. Fix some markup for the ``set server'' man page description.
Diffstat (limited to 'usr.sbin/ppp/server.c')
-rw-r--r--usr.sbin/ppp/server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/ppp/server.c b/usr.sbin/ppp/server.c
index 5d29c8b..5203d7c 100644
--- a/usr.sbin/ppp/server.c
+++ b/usr.sbin/ppp/server.c
@@ -185,6 +185,7 @@ enum server_stat
server_Reopen(struct bundle *bundle)
{
char name[sizeof server.cfg.sockname];
+ struct stat st;
u_short port;
mode_t mask;
enum server_stat ret;
@@ -193,9 +194,9 @@ server_Reopen(struct bundle *bundle)
strcpy(name, server.cfg.sockname);
mask = server.cfg.mask;
server_Close(bundle);
- if (server.cfg.sockname[0] != '\0')
- /* blow it away - and hope nobody else is using it */
- unlink(server.cfg.sockname);
+ if (server.cfg.sockname[0] != '\0' && stat(server.cfg.sockname, &st) == 0)
+ if (!(st.st_mode & S_IFSOCK) || unlink(server.cfg.sockname) != 0)
+ return SERVER_FAILED;
ret = server_LocalOpen(bundle, name, mask);
} else if (server.cfg.port != 0) {
port = server.cfg.port;
OpenPOWER on IntegriCloud