Without lowsyslog() *llerr() is not useful. Eliminate and replace with *err().

This commit is contained in:
Gregory Nutt 2016-06-20 12:39:46 -06:00
parent bb06f7368f
commit d32f16450d
5 changed files with 37 additions and 43 deletions

View File

@ -160,10 +160,7 @@ static int telnetd_daemon(int argc, char *argv[])
goto errout_with_socket;
}
/* Now go silent. Only the llerr family of debug functions should
* be used after this point because these do not depend on stdout
* being available.
*/
/* Now go silent. */
#ifndef CONFIG_DEBUG_FEATURES
close(0);
@ -181,7 +178,7 @@ static int telnetd_daemon(int argc, char *argv[])
acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen);
if (acceptsd < 0)
{
nllerr("ERROR: accept failed: %d\n", errno);
nerr("ERROR: accept failed: %d\n", errno);
goto errout_with_socket;
}
@ -192,7 +189,7 @@ static int telnetd_daemon(int argc, char *argv[])
ling.l_linger = 30; /* timeout is seconds */
if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0)
{
nllerr("ERROR: setsockopt failed: %d\n", errno);
nerr("ERROR: setsockopt failed: %d\n", errno);
goto errout_with_acceptsd;
}
#endif
@ -203,7 +200,7 @@ static int telnetd_daemon(int argc, char *argv[])
devpath = telnetd_driver(acceptsd, daemon);
if (devpath == NULL)
{
nllerr("ERROR: telnetd_driver failed\n");
nerr("ERROR: telnetd_driver failed\n");
goto errout_with_acceptsd;
}
@ -213,7 +210,7 @@ static int telnetd_daemon(int argc, char *argv[])
drvrfd = open(devpath, O_RDWR);
if (drvrfd < 0)
{
nllerr("ERROR: Failed to open %s: %d\n", devpath, errno);
nerr("ERROR: Failed to open %s: %d\n", devpath, errno);
goto errout_with_acceptsd;
}
@ -243,7 +240,7 @@ static int telnetd_daemon(int argc, char *argv[])
daemon->entry, NULL);
if (pid < 0)
{
nllerr("ERROR: Failed start the telnet session: %d\n", errno);
nerr("ERROR: Failed start the telnet session: %d\n", errno);
goto errout_with_acceptsd;
}

View File

@ -397,7 +397,7 @@ static void telnetd_sendopt(FAR struct telnetd_dev_s *priv, uint8_t option,
telnetd_dumpbuffer("Send optbuf", optbuf, 4);
if (send(priv->td_psock, optbuf, 4, 0) < 0)
{
nllerr("ERROR: Failed to send TELNET_IAC\n");
nerr("ERROR: Failed to send TELNET_IAC\n");
}
}
@ -498,7 +498,7 @@ static int telnetd_close(FAR struct file *filep)
ret = asprintf(&devpath, TELNETD_DEVFMT, priv->td_minor);
if (ret < 0)
{
nllerr("ERROR: Failed to allocate the driver path\n");
nerr("ERROR: Failed to allocate the driver path\n");
}
else
{
@ -507,7 +507,7 @@ static int telnetd_close(FAR struct file *filep)
ret = unregister_driver(devpath);
if (ret < 0)
{
nllerr("ERROR: Failed to unregister the driver %s: %d\n", devpath, ret);
nerr("ERROR: Failed to unregister the driver %s: %d\n", devpath, ret);
}
free(devpath);
@ -645,7 +645,7 @@ static ssize_t telnetd_write(FAR struct file *filep, FAR const char *buffer, siz
ret = send(priv->td_psock, priv->td_txbuffer, ncopied, 0);
if (ret < 0)
{
nllerr("ERROR: psock_send failed '%s': %d\n", priv->td_txbuffer, ret);
nerr("ERROR: psock_send failed '%s': %d\n", priv->td_txbuffer, ret);
return ret;
}
@ -662,7 +662,7 @@ static ssize_t telnetd_write(FAR struct file *filep, FAR const char *buffer, siz
ret = send(priv->td_psock, priv->td_txbuffer, ncopied, 0);
if (ret < 0)
{
nllerr("ERROR: psock_send failed '%s': %d\n", priv->td_txbuffer, ret);
nerr("ERROR: psock_send failed '%s': %d\n", priv->td_txbuffer, ret);
return ret;
}
}
@ -750,7 +750,7 @@ FAR char *telnetd_driver(long sd, FAR struct telnetd_s *daemon)
priv = (FAR struct telnetd_dev_s*)malloc(sizeof(struct telnetd_dev_s));
if (!priv)
{
nllerr("ERROR: Failed to allocate the driver data structure\n");
nerr("ERROR: Failed to allocate the driver data structure\n");
return NULL;
}
@ -786,7 +786,7 @@ FAR char *telnetd_driver(long sd, FAR struct telnetd_s *daemon)
ret = asprintf(&devpath, TELNETD_DEVFMT, priv->td_minor);
if (ret < 0)
{
nllerr("ERROR: Failed to allocate the driver path\n");
nerr("ERROR: Failed to allocate the driver path\n");
goto errout_with_dev;
}
@ -795,7 +795,7 @@ FAR char *telnetd_driver(long sd, FAR struct telnetd_s *daemon)
ret = register_driver(devpath, &g_telnetdfops, 0666, priv);
if (ret < 0)
{
nllerr("ERROR: Failed to register the driver %s: %d\n", devpath, ret);
nerr("ERROR: Failed to register the driver %s: %d\n", devpath, ret);
goto errout_with_devpath;
}

View File

@ -475,7 +475,7 @@ void ftpc_timeout(int argc, uint32_t arg1, ...)
{
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)arg1;
nllerr("ERROR: Timeout!\n");
nerr("ERROR: Timeout!\n");
DEBUGASSERT(argc == 1 && session);
kill(session->pid, CONFIG_FTP_SIGNAL);
}

View File

@ -226,10 +226,7 @@ static int telnetd_daemon(int argc, char *argv[])
goto errout_with_socket;
}
/* Now go silent. Only the llerr family of debug functions should
* be used after this point because these do not depend on stdout
* being available.
*/
/* Now go silent. */
#ifndef CONFIG_DEBUG_FEATURES
close(0);
@ -259,7 +256,7 @@ static int telnetd_daemon(int argc, char *argv[])
}
else
{
nllerr("ERROR: accept failed: %d\n", errval);
nerr("ERROR: accept failed: %d\n", errval);
goto errout_with_socket;
}
}
@ -271,7 +268,7 @@ static int telnetd_daemon(int argc, char *argv[])
ling.l_linger = 30; /* timeout is seconds */
if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0)
{
nllerr("ERROR: setsockopt failed: %d\n", errno);
nerr("ERROR: setsockopt failed: %d\n", errno);
goto errout_with_acceptsd;
}
#endif
@ -281,7 +278,7 @@ static int telnetd_daemon(int argc, char *argv[])
fd = open("/dev/telnet", O_RDONLY);
if (fd < 0)
{
nllerr("ERROR: open(/dev/telnet) failed: %d\n", errno);
nerr("ERROR: open(/dev/telnet) failed: %d\n", errno);
goto errout_with_acceptsd;
}
@ -297,7 +294,7 @@ static int telnetd_daemon(int argc, char *argv[])
if (ret < 0)
{
nllerr("ERROR: open(/dev/telnet) failed: %d\n", errno);
nerr("ERROR: open(/dev/telnet) failed: %d\n", errno);
goto errout_with_acceptsd;
}
@ -307,7 +304,7 @@ static int telnetd_daemon(int argc, char *argv[])
drvrfd = open(session.ts_devpath, O_RDWR);
if (drvrfd < 0)
{
nllerr("ERROR: Failed to open %s: %d\n", session.ts_devpath, errno);
nerr("ERROR: Failed to open %s: %d\n", session.ts_devpath, errno);
goto errout_with_acceptsd;
}
@ -333,7 +330,7 @@ static int telnetd_daemon(int argc, char *argv[])
daemon->entry, NULL);
if (pid < 0)
{
nllerr("ERROR: Failed start the telnet session: %d\n", errno);
nerr("ERROR: Failed start the telnet session: %d\n", errno);
goto errout_with_acceptsd;
}

View File

@ -378,7 +378,7 @@ static inline int cgi_interpose_input(struct cgi_conn_s *cc)
{
if (errno != EINTR)
{
nllerr("ERROR: read failed: %d\n", errno);
nerr("ERROR: read failed: %d\n", errno);
return 1;
}
}
@ -391,7 +391,7 @@ static inline int cgi_interpose_input(struct cgi_conn_s *cc)
ninfo("nbytes_written: %d\n", nbytes_written);
if (nbytes_written != nbytes_read)
{
nllerr("ERROR: httpd_write failed\n");
nerr("ERROR: httpd_write failed\n");
return 1;
}
cgi_dumpbuffer("Sent to CGI:", cc->inbuf.buffer, nbytes_written);
@ -469,7 +469,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc)
{
if (errno != EAGAIN)
{
nllerr("ERROR: read: %d\n", errno);
nerr("ERROR: read: %d\n", errno);
}
return 1;
}
@ -651,7 +651,7 @@ static inline int cgi_interpose_output(struct cgi_conn_s *cc)
{
if (errno != EAGAIN)
{
nllerr("ERROR: read: %d\n", errno);
nerr("ERROR: read: %d\n", errno);
}
return 1;
}
@ -720,7 +720,7 @@ static int cgi_child(int argc, char **argv)
cc = (FAR struct cgi_conn_s*)httpd_malloc(sizeof(struct cgi_conn_s));
if (!cc)
{
nllerr("ERROR: cgi_conn allocation failed\n");
nerr("ERROR: cgi_conn allocation failed\n");
close(hc->conn_fd);
goto errout;
}
@ -768,7 +768,7 @@ static int cgi_child(int argc, char **argv)
ret = pipe(pipefd);
if (ret < 0)
{
nllerr("ERROR: STDIN pipe: %d\n", errno);
nerr("ERROR: STDIN pipe: %d\n", errno);
goto errout_with_cgiconn;
}
else
@ -784,7 +784,7 @@ static int cgi_child(int argc, char **argv)
if (ret < 0)
{
nllerr("ERROR: STDIN dup2: %d\n", errno);
nerr("ERROR: STDIN dup2: %d\n", errno);
goto errout_with_descriptors;
}
}
@ -799,7 +799,7 @@ static int cgi_child(int argc, char **argv)
ret = pipe(pipefd);
if (ret < 0)
{
nllerr("ERROR: STDOUT pipe: %d\n", errno);
nerr("ERROR: STDOUT pipe: %d\n", errno);
goto errout_with_descriptors;
}
else
@ -815,7 +815,7 @@ static int cgi_child(int argc, char **argv)
if (ret < 0)
{
nllerr("ERROR: STDOUT dup2: %d\n", errno);
nerr("ERROR: STDOUT dup2: %d\n", errno);
goto errout_with_descriptors;
}
}
@ -842,7 +842,7 @@ static int cgi_child(int argc, char **argv)
httpd_realloc_str(&cc->outbuf.buffer, &cc->outbuf.size, CONFIG_THTTPD_CGIOUTBUFFERSIZE);
if (!cc->outbuf.buffer)
{
nllerr("ERROR: hdr allocation failed\n");
nerr("ERROR: hdr allocation failed\n");
goto errout_with_descriptors;
}
@ -851,7 +851,7 @@ static int cgi_child(int argc, char **argv)
fw = fdwatch_initialize(2);
if (!fw)
{
nllerr("ERROR: fdwatch allocation failed\n");
nerr("ERROR: fdwatch allocation failed\n");
goto errout_with_outbuffer;
}
@ -868,7 +868,7 @@ static int cgi_child(int argc, char **argv)
{
/* Something went wrong. */
nllerr("ERROR: execve %s: %d\n", hc->expnfilename, errno);
nerr("ERROR: execve %s: %d\n", hc->expnfilename, errno);
goto errout_with_watch;
}
@ -878,7 +878,7 @@ static int cgi_child(int argc, char **argv)
client_data.i = child;
if (tmr_create(NULL, cgi_kill, client_data, CONFIG_THTTPD_CGI_TIMELIMIT * 1000L, 0) == NULL)
{
nllerr("ERROR: tmr_create(cgi_kill child) failed\n");
nerr("ERROR: tmr_create(cgi_kill child) failed\n");
goto errout_with_watch;
}
#endif
@ -896,7 +896,7 @@ static int cgi_child(int argc, char **argv)
{
if (httpd_write(cc->wrfd, &(hc->read_buf[hc->checked_idx]), nbytes) != nbytes)
{
nllerr("ERROR: httpd_write failed\n");
nerr("ERROR: httpd_write failed\n");
return 1;
}
}
@ -1077,7 +1077,7 @@ static void cgi_kill(ClientData client_data, struct timeval *nowP)
ninfo("Killing CGI child: %d\n", pid);
if (task_delete(pid) != 0)
{
nllerr("ERROR: task_delete() failed: %d\n", errno);
nerr("ERROR: task_delete() failed: %d\n", errno);
}
}
#endif