summaryrefslogtreecommitdiff
path: root/nslcd/nslcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nslcd/nslcd.c')
-rw-r--r--nslcd/nslcd.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index c0cf90e..a1d450a 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -161,8 +161,8 @@ static void exithandler(void)
if (nslcd_serversocket >= 0)
{
if (close(nslcd_serversocket))
- log_log(LOG_WARNING, "problem closing server socket (ignored):%d: %s",
- nslcd_serversocket, strerror(errno));
+ log_log(LOG_WARNING, "problem closing server socket (ignored):%d",
+ nslcd_serversocket);
}
/* log exit */
log_log(LOG_INFO, "version %s bailing out", VERSION);
@@ -174,8 +174,10 @@ static int get_socket()
r = sd_listen_fds(1);
if (r != 1) {
if (r < 0)
- log_log(LOG_ERR, "failed to aquire sockets from systemd: %s",
- strerror(-r));
+ {
+ errno = -r;
+ log_log(LOG_ERR, "failed to aquire sockets from systemd");
+ }
else
log_log(LOG_ERR, "wrong number of sockets from systemd: "
"expected %d but got %d", 1, r);
@@ -188,8 +190,10 @@ static int get_socket()
if (r < 1)
{
if (r < 0)
- log_log(LOG_ERR, "unable to verify socket type:%d: %s",
- fd, strerror(-r));
+ {
+ errno = -r;
+ log_log(LOG_ERR, "unable to verify socket type:%d", fd);
+ }
else
log_log(LOG_ERR, "socket not of the right type:%d", fd);
exit(EXIT_FAILURE);
@@ -226,7 +230,7 @@ static void handleconnection(int sock, struct session *session)
pid_t pid = (pid_t)-1;
/* log connection */
if (getpeercred(sock, &uid, &gid, &pid))
- log_log(LOG_DEBUG, "connection from unknown client: %s", strerror(errno));
+ log_log(LOG_DEBUG, "connection from unknown client");
else
log_log(LOG_DEBUG, "connection from pid=%d uid=%d gid=%d",
(int)pid, (int)uid, (int)gid);
@@ -235,8 +239,7 @@ static void handleconnection(int sock, struct session *session)
READBUFFER_MINSIZE, READBUFFER_MAXSIZE,
WRITEBUFFER_MINSIZE, WRITEBUFFER_MAXSIZE)) == NULL)
{
- log_log(LOG_WARNING, "cannot create stream for writing: %s",
- strerror(errno));
+ log_log(LOG_WARNING, "cannot create stream for writing");
(void)close(sock);
return;
}
@@ -265,8 +268,8 @@ static void install_sighandler(int signum, void (*handler) (int))
act.sa_flags = SA_RESTART | SA_NOCLDSTOP;
if (sigaction(signum, &act, NULL) != 0)
{
- log_log(LOG_ERR, "error installing signal handler for '%s': %s",
- signame(signum), strerror(errno));
+ log_log(LOG_ERR, "error installing signal handler for '%s'",
+ signame(signum));
exit(EXIT_FAILURE);
}
}
@@ -303,9 +306,9 @@ static void *worker(void *_sess)
if (j < 0)
{
if (errno == EINTR)
- log_log(LOG_DEBUG, "select() failed (ignored): %s", strerror(errno));
+ log_log(LOG_DEBUG, "select() failed (ignored)");
else
- log_log(LOG_ERR, "select() failed: %s", strerror(errno));
+ log_log(LOG_ERR, "select() failed");
continue;
}
/* see if our file descriptor is actually ready */
@@ -317,24 +320,24 @@ static void *worker(void *_sess)
if (csock < 0)
{
if ((errno == EINTR) || (errno == EAGAIN) || (errno == EWOULDBLOCK))
- log_log(LOG_DEBUG, "accept() failed (ignored): %s", strerror(errno));
+ log_log(LOG_DEBUG, "accept() failed (ignored)");
else
- log_log(LOG_ERR, "accept() failed: %s", strerror(errno));
+ log_log(LOG_ERR, "accept() failed");
continue;
}
/* make sure O_NONBLOCK is not inherited */
if ((j = fcntl(csock, F_GETFL, 0)) < 0)
{
- log_log(LOG_ERR, "fctnl(F_GETFL) failed: %s", strerror(errno));
+ log_log(LOG_ERR, "fctnl(F_GETFL) failed");
if (close(csock))
- log_log(LOG_WARNING, "problem closing socket: %s", strerror(errno));
+ log_log(LOG_WARNING, "problem closing socket");
continue;
}
if (fcntl(csock, F_SETFL, j & ~O_NONBLOCK) < 0)
{
- log_log(LOG_ERR, "fctnl(F_SETFL,~O_NONBLOCK) failed: %s", strerror(errno));
+ log_log(LOG_ERR, "fctnl(F_SETFL,~O_NONBLOCK) failed");
if (close(csock))
- log_log(LOG_WARNING, "problem closing socket: %s", strerror(errno));
+ log_log(LOG_WARNING, "problem closing socket");
continue;
}
/* indicate new connection to logging module (generates unique id) */
@@ -388,8 +391,7 @@ static void disable_nss_module(void)
/* fall back to changing the way host lookup is done */
#ifdef HAVE___NSS_CONFIGURE_LOOKUP
if (__nss_configure_lookup("hosts", "files dns"))
- log_log(LOG_ERR, "unable to override hosts lookup method: %s",
- strerror(errno));
+ log_log(LOG_ERR, "unable to override hosts lookup method");
#endif /* HAVE___NSS_CONFIGURE_LOOKUP */
dlclose(handle);
return;
@@ -422,7 +424,7 @@ int main(int argc, char *argv[])
/* install handler to close stuff off on exit and log notice */
if (atexit(exithandler))
{
- log_log(LOG_ERR, "atexit() failed: %s", strerror(errno));
+ log_log(LOG_ERR, "atexit() failed");
exit(EXIT_FAILURE);
}
/* get socket */
@@ -458,8 +460,7 @@ int main(int argc, char *argv[])
{
if (pthread_create(&nslcd_threads[i], NULL, worker, (void*)session))
{
- log_log(LOG_ERR, "unable to start worker thread %d: %s",
- i, strerror(errno));
+ log_log(LOG_ERR, "unable to start worker thread %d", i);
exit(EXIT_FAILURE);
}
}
@@ -493,8 +494,7 @@ int main(int argc, char *argv[])
/* cancel all running threads */
for (i = 0; i < nslcd_cfg->threads; i++)
if (pthread_cancel(nslcd_threads[i]))
- log_log(LOG_WARNING, "failed to stop thread %d (ignored): %s",
- i, strerror(errno));
+ log_log(LOG_WARNING, "failed to stop thread %d (ignored)", i);
/* close server socket to trigger failures in threads waiting on accept() */
close(nslcd_serversocket);
nslcd_serversocket = -1;