aboutsummaryrefslogtreecommitdiff
path: root/login/programs/utmpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'login/programs/utmpd.c')
-rw-r--r--login/programs/utmpd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/login/programs/utmpd.c b/login/programs/utmpd.c
index 1469d94ca7..e0648ebb42 100644
--- a/login/programs/utmpd.c
+++ b/login/programs/utmpd.c
@@ -141,6 +141,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
if (check_pid (_PATH_UTMPDPID))
error (EXIT_FAILURE, 0, _("already running"));
+ /* Cleanup files created by a previous `bind'. */
+ unlink (_PATH_UTMPD_RO);
+ unlink (_PATH_UTMPD_RW);
+
/* Open UTMP database. */
utmp_db = open_database (_PATH_UTMP "x", _PATH_UTMP);
if (utmp_db == NULL)
@@ -248,6 +252,7 @@ make_socket (const char *name)
size = (offsetof (struct sockaddr_un, sun_path)
+ strlen (addr.sun_path));
+
if (bind (sock, (struct sockaddr *) &addr, size) < 0)
error (EXIT_FAILURE, errno, "%s", name);