summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/acl.c6
-rw-r--r--src/buffer.c15
-rw-r--r--src/dnscache.c6
-rw-r--r--src/reqs.c45
-rw-r--r--src/sock.c8
-rw-r--r--src/tinyproxy.c44
-rw-r--r--src/uri.c10
-rw-r--r--src/utils.c22
8 files changed, 85 insertions, 71 deletions
diff --git a/src/acl.c b/src/acl.c
index cbff57d..1b6d6d3 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1,4 +1,4 @@
-/* $Id: acl.c,v 1.4 2001-05-27 02:20:54 rjkaes Exp $
+/* $Id: acl.c,v 1.5 2001-09-07 04:16:33 rjkaes Exp $
*
* This system handles Access Control for use of this daemon. A list of
* domains, or IP addresses (including IP blocks) are stored in a list
@@ -197,7 +197,7 @@ int check_acl(int fd)
if ((test_addr.s_addr & netmask_addr) == (match_addr.s_addr & netmask_addr)) {
if (aclptr->acl_access == ACL_DENY) {
- log_message(LOG_NOTICE, "Unauthorized access from %s", ip_address);
+ log_message(LOG_NOTICE, "Unauthorized access from [%s].", ip_address);
return 0;
} else {
return 1;
@@ -215,6 +215,6 @@ int check_acl(int fd)
/*
* Deny all connections by default.
*/
- log_message(LOG_NOTICE, "Unauthorized connection from %s [%s]", string_address, ip_address);
+ log_message(LOG_NOTICE, "Unauthorized connection from \"%s\" [%s].", string_address, ip_address);
return 0;
}
diff --git a/src/buffer.c b/src/buffer.c
index c405581..9001372 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,4 +1,4 @@
-/* $Id: buffer.c,v 1.5 2001-05-27 02:23:08 rjkaes Exp $
+/* $Id: buffer.c,v 1.6 2001-09-07 04:17:03 rjkaes Exp $
*
* The buffer used in each connection is a linked list of lines. As the lines
* are read in and written out the buffer expands and contracts. Basically,
@@ -199,7 +199,7 @@ ssize_t readbuff(int fd, struct buffer_s *buffptr)
if (bytesin > 0) {
if (!(buffer = malloc(bytesin))) {
- log_message(LOG_CRIT, "Could not allocate memory in readbuff() [%s:%d]", __FILE__, __LINE__);
+ log_message(LOG_ERR, "Could not allocate memory in 'readbuff'");
return 0;
}
@@ -224,7 +224,8 @@ ssize_t readbuff(int fd, struct buffer_s *buffptr)
case EINTR:
return 0;
default:
- log_message(LOG_ERR, "readbuff: recv (%s)", strerror(errno));
+ log_message(LOG_ERR, "recv error (%s) in 'readbuff'.",
+ strerror(errno));
return -1;
}
}
@@ -268,10 +269,14 @@ ssize_t writebuff(int fd, struct buffer_s *buffptr)
return 0;
case ENOBUFS:
case ENOMEM:
- log_message(LOG_ERR, "writebuff: send [NOBUFS/NOMEM] %s", strerror(errno));
+ log_message(LOG_ERR,
+ "send error [NOBUFS/NOMEM] (%s) in 'writebuff'.",
+ strerror(errno));
return 0;
default:
- log_message(LOG_ERR, "writebuff: send (%s)", strerror(errno));
+ log_message(LOG_ERR,
+ "send error (%s) in 'writebuff'.",
+ strerror(errno));
return -1;
}
}
diff --git a/src/dnscache.c b/src/dnscache.c
index 27f5136..30457a9 100644
--- a/src/dnscache.c
+++ b/src/dnscache.c
@@ -1,4 +1,4 @@
-/* $Id: dnscache.c,v 1.13 2001-09-07 00:40:34 rjkaes Exp $
+/* $Id: dnscache.c,v 1.14 2001-09-07 04:17:26 rjkaes Exp $
*
* This is a caching DNS system. When a host name is needed we look it up here
* and see if there is already an answer for it. The domains are placed in a
@@ -131,13 +131,13 @@ int dnscache(struct in_addr *addr, char *domain)
return -1;
}
- memcpy(addr, resolv->h_addr_list[0], (size_t)resolv->h_length);
+ memcpy(addr, resolv->h_addr_list[0], resolv->h_length);
dns_insert(addr, domain);
dns_insertions++;
if (dns_insertions > DNS_INSERT_LIMIT) {
- log_message(LOG_NOTICE, "DNS Insertion limit, rebuilding cache.");
+ log_message(LOG_INFO, "DNS Insertion limit reached (%u). Rebuilding cache.", dns_insertions);
ternary_destroy(dns_tree, free);
dns_tree = ternary_new();
dns_insertions = 0;
diff --git a/src/reqs.c b/src/reqs.c
index 7db1b5c..3f55c42 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.19 2001-09-04 18:22:00 rjkaes Exp $
+/* $Id: reqs.c,v 1.20 2001-09-07 04:18:04 rjkaes Exp $
*
* This is where all the work in tinyproxy is actually done. Incoming
* connections have a new thread created for them. The thread then
@@ -126,7 +126,7 @@ static int process_method(struct conn_s *connptr)
len = readline(connptr->client_fd, inbuf, LINE_LENGTH);
if (len <= 0) {
- log_message(LOG_ERR, "client closed before read");
+ log_message(LOG_ERR, "Client [%s] closed socket before read.", peer_ipaddr);
update_stats(STAT_BADCONN);
return -2;
}
@@ -139,13 +139,13 @@ static int process_method(struct conn_s *connptr)
log_message(LOG_CONN, "Request: %s", inbuf);
if (regcomp(&preg, HTTPPATTERN, REG_EXTENDED | REG_ICASE) != 0) {
- log_message(LOG_ERR, "clientreq: regcomp");
+ log_message(LOG_ERR, "Regular Expression compiling error.");
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
goto EARLY_EXIT;
}
if (regexec(&preg, inbuf, NMATCH, pmatch, 0) != 0) {
- log_message(LOG_ERR, "clientreq: regexec");
+ log_message(LOG_ERR, "Regular Expression search error.");
regfree(&preg);
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
@@ -163,8 +163,8 @@ static int process_method(struct conn_s *connptr)
if (pmatch[METHOD_IND].rm_so == -1 || pmatch[URI_IND].rm_so == -1) {
- log_message(LOG_ERR, "clientreq: Incomplete line from %s (%s)",
- peer_ipaddr, inbuf);
+ log_message(LOG_ERR, "Incomplete request line from [%s].",
+ peer_ipaddr);
httperr(connptr, 400, HTTP400ERROR);
update_stats(STAT_BADCONN);
goto EARLY_EXIT;
@@ -173,8 +173,8 @@ static int process_method(struct conn_s *connptr)
len = pmatch[URI_IND].rm_eo - pmatch[URI_IND].rm_so;
if (!(buffer = malloc(len + 1))) {
log_message(LOG_ERR,
- "clientreq: Cannot allocate buffer for request from %s",
- peer_ipaddr);
+ "Could not allocate memory for request from [%s].",
+ peer_ipaddr);
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
goto EARLY_EXIT;
@@ -183,7 +183,6 @@ static int process_method(struct conn_s *connptr)
buffer[len] = '\0';
if (!(uri = explode_uri(buffer))) {
safefree(buffer);
- log_message(LOG_ERR, "clientreq: Problem with explode_uri");
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
goto EARLY_EXIT;
@@ -196,7 +195,9 @@ static int process_method(struct conn_s *connptr)
size_t error_string_len = strlen(uri->scheme) + 64;
error_string = malloc(error_string_len);
if (!error_string) {
- log_message(LOG_CRIT, "Out of Memory!");
+ log_message(LOG_ERR,
+ "Could not allocate memory for request from [%s].",
+ peer_ipaddr);
goto COMMON_EXIT;
}
snprintf(error_string, error_string_len,
@@ -206,7 +207,9 @@ static int process_method(struct conn_s *connptr)
error_string =
strdup("Invalid scheme (NULL). Only HTTP is allowed.");
if (!error_string) {
- log_message(LOG_CRIT, "Out of Memory!");
+ log_message(LOG_ERR,
+ "Could not allocate memory for request from [%s].",
+ peer_ipaddr);
goto COMMON_EXIT;
}
}
@@ -239,10 +242,12 @@ static int process_method(struct conn_s *connptr)
/* Filter domains out */
if (config.filter) {
if (filter_url(uri->authority)) {
- log_message(LOG_ERR, "clientreq: Filtered connection (%s)",
- peer_ipaddr);
+ log_message(LOG_ERR,
+ "Proxying refused on filtered domain \"%s\" from [%s].",
+ uri->authority,
+ peer_ipaddr);
httperr(connptr, 404,
- "Unable to connect to filtered host.");
+ "Connection to filtered domain is not allowed.");
update_stats(STAT_DENIED);
goto COMMON_EXIT;
}
@@ -253,8 +258,8 @@ static int process_method(struct conn_s *connptr)
request_len = strlen(inbuf) + 1;
if (!(request = malloc(request_len))) {
log_message(LOG_ERR,
- "clientreq: cannot allocate buffer for request from %s",
- peer_ipaddr);
+ "Could not allocate memory for request from [%s].",
+ peer_ipaddr);
httperr(connptr, 503, HTTP503ERROR);
update_stats(STAT_BADCONN);
goto COMMON_EXIT;
@@ -544,7 +549,7 @@ static void relay_connection(struct conn_s *connptr)
if (ret == 0) {
tdiff = difftime(time(NULL), last_access);
if (tdiff > config.idletimeout) {
- log_message(LOG_INFO, "Idle Timeout (after select) %g > %u", tdiff, config.idletimeout);
+ log_message(LOG_INFO, "Idle Timeout (after select) as %g > %u.", tdiff, config.idletimeout);
return;
} else {
continue;
@@ -642,7 +647,9 @@ void handle_connection(int fd)
connptr = malloc(sizeof(struct conn_s));
if (!connptr) {
- log_message(LOG_CRIT, "Out of memory!");
+ log_message(LOG_ERR,
+ "Could not allocate memory for request from [%s]",
+ peer_ipaddr);
return;
}
@@ -669,7 +676,7 @@ void handle_connection(int fd)
connptr->server_fd = opensock(config.tunnel_name, config.tunnel_port);
if (connptr->server_fd < 0) {
- log_message(LOG_ERR, "Could not connect to tunnel's end, see if we can handle it ourselves.");
+ log_message(LOG_WARNING, "Could not connect to tunnel's end, see if we can handle it ourselves.");
goto internal_proxy;
}
diff --git a/src/sock.c b/src/sock.c
index 05d1587..bea3bad 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -1,4 +1,4 @@
-/* $Id: sock.c,v 1.6 2001-08-29 04:00:22 rjkaes Exp $
+/* $Id: sock.c,v 1.7 2001-09-07 04:18:26 rjkaes Exp $
*
* Sockets are created and destroyed here. When a new connection comes in from
* a client, we need to copy the socket and the create a second socket to the
@@ -66,19 +66,19 @@ int opensock(char *ip_addr, uint16_t port)
ret = dnscache(&port_info.sin_addr, ip_addr);
if (ret < 0) {
- log_message(LOG_ERR, "opensock: Could not lookup address: %s", ip_addr);
+ log_message(LOG_ERR, "Could not lookup address [%s].", ip_addr);
return -1;
}
port_info.sin_port = htons(port);
if ((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
- log_message(LOG_ERR, "opensock: socket (%s)", strerror(errno));
+ log_message(LOG_ERR, "Could not create socket because of '%s'.", strerror(errno));
return -1;
}
if (connect(sock_fd, (struct sockaddr*)&port_info, sizeof(port_info)) < 0) {
- log_message(LOG_ERR, "connecting socket");
+ log_message(LOG_ERR, "Could not connect socket because of '%s'", strerror(errno));
return -1;
}
diff --git a/src/tinyproxy.c b/src/tinyproxy.c
index e4c8415..dfdc0be 100644
--- a/src/tinyproxy.c
+++ b/src/tinyproxy.c
@@ -1,4 +1,4 @@
-/* $Id: tinyproxy.c,v 1.13 2001-08-29 04:01:05 rjkaes Exp $
+/* $Id: tinyproxy.c,v 1.14 2001-09-07 04:20:26 rjkaes Exp $
*
* The initialise routine. Basically sets up all the initial stuff (logfile,
* listening socket, config options, etc.) and then sits there and loops
@@ -65,7 +65,7 @@ void takesig(int sig)
if (config.logf)
ftruncate(fileno(config.logf), 0);
- log_message(LOG_NOTICE, "SIGHUP received, cleaning up...");
+ log_message(LOG_NOTICE, "SIGHUP received, cleaning up.");
#ifdef FILTER_ENABLE
if (config.filter) {
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
#ifdef HAVE_SETRLIMIT
struct rlimit core_limit = {0, 0};
if (setrlimit(RLIMIT_CORE, &core_limit) < 0) {
- log_message(LOG_CRIT, "tinyproxy: could not set the core limit to zero.");
+ fprintf(stderr, "%s: Could not set the core limit to zero.\n", argv[0]);
exit(EX_SOFTWARE);
}
#endif /* HAVE_SETRLIMIT */
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
case 'c':
conf_file = strdup(optarg);
if (!conf_file) {
- log_message(LOG_EMERG, "tinyproxy: could not allocate memory");
+ fprintf(stderr, "%s: Could not allocate memory.\n", argv[0]);
exit(EX_SOFTWARE);
}
break;
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
*/
yyin = fopen(conf_file, "r");
if (!yyin) {
- log_message(LOG_ERR, "Could not open %s file", conf_file);
+ fprintf(stderr, "%s: Could not open configuration file \"%s\".\n", argv[0], conf_file);
exit(EX_SOFTWARE);
}
yyparse();
@@ -220,13 +220,13 @@ int main(int argc, char **argv)
/* Open the log file if not using syslog */
if (config.syslog == FALSE) {
if (!config.logf_name) {
- fprintf(stderr, "You MUST set a LogFile in the configuration file.\n");
+ fprintf(stderr, "%s: You MUST set a LogFile in the configuration file.\n", argv[0]);
exit(EX_SOFTWARE);
}
if (!(config.logf = fopen(config.logf_name, "a"))) {
fprintf(stderr,
- "Unable to open logfile %s for appending!\n",
+ "Could not append to log file \"%s\".\n",
config.logf_name);
exit(EX_CANTCREAT);
}
@@ -243,18 +243,18 @@ int main(int argc, char **argv)
* Set the default values if they were not set in the config file.
*/
if (config.port == 0) {
- fprintf(stderr, "You MUST set a Port in the configuration file\n");
+ fprintf(stderr, "%s: You MUST set a Port in the configuration file.\n", argv[0]);
exit(EX_SOFTWARE);
}
if (!config.stathost) {
- log_message(LOG_INFO, "Setting stathost to \"%s\"", DEFAULT_STATHOST);
+ log_message(LOG_INFO, "Setting stathost to \"%s\".", DEFAULT_STATHOST);
config.stathost = DEFAULT_STATHOST;
}
if (!config.username) {
log_message(LOG_WARNING, "You SHOULD set a UserName in the configuration file. Using current user instead.");
}
if (config.idletimeout == 0) {
- log_message(LOG_INFO, "Setting idle timeout to %u seconds", MAX_IDLE_TIME);
+ log_message(LOG_INFO, "Setting idle timeout to %u seconds.", MAX_IDLE_TIME);
config.idletimeout = MAX_IDLE_TIME;
}
@@ -280,7 +280,7 @@ int main(int argc, char **argv)
}
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
- log_message(LOG_CRIT, "Could not set SIGPIPE\n");
+ fprintf(stderr, "%s: Could not set the \"SIGPIPE\" signal.\n", argv[0]);
exit(EX_OSERR);
}
@@ -293,7 +293,7 @@ int main(int argc, char **argv)
* Start listening on the selected port.
*/
if (thread_listening_sock(config.port) < 0) {
- log_message(LOG_CRIT, "Problem creating listening socket");
+ fprintf(stderr, "%s: Could not create listening socket.\n", argv[0]);
exit(EX_OSERR);
}
@@ -304,33 +304,33 @@ int main(int argc, char **argv)
if (config.group && strlen(config.group) > 0) {
thisgroup = getgrnam(config.group);
if (!thisgroup) {
- log_message(LOG_ERR, "Unable to find group '%s'!", config.group);
+ fprintf(stderr, "%s: Unable to find group \"%s\".\n", argv[0], config.group);
exit(EX_NOUSER);
}
if (setgid(thisgroup->gr_gid) < 0) {
- log_message(LOG_ERR, "Unable to change to group '%s'", config.group);
+ fprintf(stderr, "%s: Unable to change to group \"%s\".\n", argv[0], config.group);
exit(EX_CANTCREAT);
}
- log_message(LOG_INFO, "Now running as group %s", config.group);
+ log_message(LOG_INFO, "Now running as group \"%s\".", config.group);
}
if (config.username && strlen(config.username) > 0) {
thisuser = getpwnam(config.username);
if (!thisuser) {
- log_message(LOG_ERR, "Unable to find user '%s'!", config.username);
+ fprintf(stderr, "%s: Unable to find user \"%s\".", argv[0], config.username);
exit(EX_NOUSER);
}
if (setuid(thisuser->pw_uid) < 0) {
- log_message(LOG_ERR, "Unable to change to user '%s'", config.username);
+ fprintf(stderr, "%s: Unable to change to user \"%s\".", argv[0], config.username);
exit(EX_CANTCREAT);
}
- log_message(LOG_INFO, "Now running as user %s", config.username);
+ log_message(LOG_INFO, "Now running as user \"%s\".", config.username);
}
} else {
log_message(LOG_WARNING, "Not running as root, so not changing UID/GID.");
}
if (thread_pool_create() < 0) {
- log_message(LOG_ERR, "Could not create the pool of threads");
+ fprintf(stderr, "%s: Could not create the pool of threads.", argv[0]);
exit(EX_SOFTWARE);
}
@@ -339,11 +339,11 @@ int main(int argc, char **argv)
*/
log_message(LOG_INFO, "Setting the various signals.");
if (signal(SIGTERM, takesig) == SIG_ERR) {
- log_message(LOG_CRIT, "Could not set SIGTERM\n");
+ fprintf(stderr, "%s: Could not set the \"SIGTERM\" signal.\n", argv[0]);
exit(EX_OSERR);
}
if (signal(SIGHUP, takesig) == SIG_ERR) {
- log_message(LOG_CRIT, "Could not set SIGHUP\n");
+ fprintf(stderr, "%s: Could not set the \"SIGHUP\" signal.\n", argv[0]);
exit(EX_OSERR);
}
@@ -363,7 +363,7 @@ int main(int argc, char **argv)
* Remove the PID file.
*/
if (unlink(config.pidpath) < 0) {
- log_message(LOG_WARNING, "Could not remove PID file %s: %s",
+ log_message(LOG_WARNING, "Could not remove PID file \"%s\": %s.",
config.pidpath, strerror(errno));
}
diff --git a/src/uri.c b/src/uri.c
index af1ec7d..77d7ffc 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -1,4 +1,4 @@
-/* $Id: uri.c,v 1.4 2001-05-27 02:37:18 rjkaes Exp $
+/* $Id: uri.c,v 1.5 2001-09-07 04:20:45 rjkaes Exp $
*
* This borrows the REGEX from RFC2396 to split a URI string into the five
* primary components. The components are:
@@ -44,8 +44,10 @@ static int extract_uri(regmatch_t pmatch[], const char *buffer, char **section,
int substring)
{
size_t len = pmatch[substring].rm_eo - pmatch[substring].rm_so;
- if ((*section = malloc(len + 1)) == NULL)
+ if ((*section = malloc(len + 1)) == NULL) {
+ log_message(LOG_ERR, "Could not allocate memory for extracting URI.");
return -1;
+ }
memset(*section, '\0', len + 1);
memcpy(*section, buffer + pmatch[substring].rm_so, len);
@@ -74,12 +76,12 @@ URI *explode_uri(const char *string)
memset(uri, 0, sizeof(URI));
if (regcomp(&preg, URIPATTERN, REG_EXTENDED) != 0) {
- log_message(LOG_ERR, "explode_uri: regcomp");
+ log_message(LOG_ERR, "Regular Expression compiler error.");
goto ERROR_EXIT;
}
if (regexec(&preg, string, NMATCH, pmatch, 0) != 0) {
- log_message(LOG_ERR, "explode_uri: regexec");
+ log_message(LOG_ERR, "Regular Expression search error.");
goto ERROR_EXIT;
}
diff --git a/src/utils.c b/src/utils.c
index 9c7bf19..228b79f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.8 2001-08-30 16:52:56 rjkaes Exp $
+/* $Id: utils.c,v 1.9 2001-09-07 04:21:07 rjkaes Exp $
*
* Misc. routines which are used by the various functions to handle strings
* and memory allocation and pretty much anything else we can think of. Also,
@@ -62,13 +62,13 @@ int httperr(struct conn_s *connptr, int err, const char *msg)
header_buffer = malloc(HEADER_SIZE);
if (!header_buffer) {
- log_message(LOG_CRIT, "Out of memory!");
+ log_message(LOG_ERR, "Could not allocate memory.");
return -1;
}
message_buffer = malloc(MAXBUFFSIZE);
if (!message_buffer) {
- log_message(LOG_CRIT, "Out of memory!");
+ log_message(LOG_ERR, "Could not allocate memory.");
safefree(header_buffer);
return -1;
}
@@ -82,7 +82,7 @@ int httperr(struct conn_s *connptr, int err, const char *msg)
output_size = strlen(message_buffer) + strlen(header_buffer);
connptr->output_message = malloc(output_size + 1);
if (!connptr->output_message) {
- log_message(LOG_CRIT, "Out of memory!");
+ log_message(LOG_ERR, "Could not allocate memory.");
safefree(header_buffer);
safefree(message_buffer);
return -1;
@@ -135,7 +135,7 @@ static int create_file_safely(const char *filename)
* existing", exit.
*/
if (errno != ENOENT) {
- log_message(LOG_ERR, "Error checking PID file %s: %s",
+ log_message(LOG_ERR, "Error checking PID file %s: %s.",
filename, strerror(errno));
return -1;
}
@@ -146,7 +146,7 @@ static int create_file_safely(const char *filename)
* and open()
*/
if ((fildes = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600)) < 0) {
- log_message(LOG_ERR, "Could not create PID file %s: %s",
+ log_message(LOG_ERR, "Could not create PID file %s: %s.",
filename, strerror(errno));
return -1;
}
@@ -157,7 +157,7 @@ static int create_file_safely(const char *filename)
* Open an existing file.
*/
if ((fildes = open(filename, O_RDWR)) < 0) {
- log_message(LOG_ERR, "Could not open PID file %s: %s",
+ log_message(LOG_ERR, "Could not open PID file %s: %s.",
filename, strerror(errno));
return -1;
}
@@ -170,7 +170,7 @@ static int create_file_safely(const char *filename)
|| lstatinfo.st_mode != fstatinfo.st_mode
|| lstatinfo.st_ino != fstatinfo.st_ino
|| lstatinfo.st_dev != fstatinfo.st_dev) {
- log_message(LOG_ERR, "The PID file %s has been changed before it could be opened!",
+ log_message(LOG_ERR, "The PID file %s has been changed before it could be opened.",
filename);
close(fildes);
return -1;
@@ -184,7 +184,7 @@ static int create_file_safely(const char *filename)
* st_mode check would also find this)
*/
if (fstatinfo.st_nlink > 1 || !S_ISREG(lstatinfo.st_mode)) {
- log_message(LOG_ERR, "The PID file %s has too many links, or is not a regular file: %s",
+ log_message(LOG_ERR, "The PID file %s has too many links, or is not a regular file: %s.",
filename, strerror(errno));
close(fildes);
return -1;
@@ -203,7 +203,7 @@ static int create_file_safely(const char *filename)
#else
close(fildes);
if ((fildes = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600)) < 0) {
- log_message(LOG_ERR, "Could not open PID file %s: %s",
+ log_message(LOG_ERR, "Could not open PID file %s: %s.",
filename, strerror(errno));
return -1;
}
@@ -231,7 +231,7 @@ void pidfile_create(const char *filename)
* Open a stdio file over the low-level one.
*/
if ((fd = fdopen(fildes, "w")) == NULL) {
- log_message(LOG_ERR, "fdopen() error on PID file %s: %s",
+ log_message(LOG_ERR, "fdopen() error on PID file %s: %s.",
filename, strerror(errno));
close(fildes);
unlink(filename);