projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace zu with PRIu64 and llu with new macro, PRIsz, which will make it easier to...
[collectd.git]
/
src
/
email.c
diff --git
a/src/email.c
b/src/email.c
index
e5f015b
..
82fdb9f
100644
(file)
--- a/
src/email.c
+++ b/
src/email.c
@@
-276,7
+276,7
@@
static void *collect(void *arg) {
len = strlen(line);
if ((line[len - 1] != '\n') && (line[len - 1] != '\r')) {
len = strlen(line);
if ((line[len - 1] != '\n') && (line[len - 1] != '\r')) {
- log_warn("collect: line too long (> %
zu
characters): "
+ log_warn("collect: line too long (> %
" PRIsz "
characters): "
"'%s' (truncated)",
sizeof(line) - 1, line);
"'%s' (truncated)",
sizeof(line) - 1, line);
@@
-373,14
+373,13
@@
static void *open_connection(void __attribute__((unused)) * arg) {
pthread_exit((void *)1);
}
pthread_exit((void *)1);
}
- struct sockaddr_un addr = {
- .sun_family = AF_UNIX
- };
+ struct sockaddr_un addr = {.sun_family = AF_UNIX};
sstrncpy(addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
errno = 0;
if (bind(connector_socket, (struct sockaddr *)&addr,
sstrncpy(addr.sun_path, path, (size_t)(UNIX_PATH_MAX - 1));
errno = 0;
if (bind(connector_socket, (struct sockaddr *)&addr,
- offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path)) == -1) {
+ offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path)) ==
+ -1) {
char errbuf[1024];
disabled = 1;
close(connector_socket);
char errbuf[1024];
disabled = 1;
close(connector_socket);
@@
-402,9
+401,15
@@
static void *open_connection(void __attribute__((unused)) * arg) {
{
struct group sg;
struct group *grp;
{
struct group sg;
struct group *grp;
- char grbuf[4096];
int status;
int status;
+ long int grbuf_size = sysconf(_SC_GETGR_R_SIZE_MAX);
+ if (grbuf_size <= 0)
+ grbuf_size = sysconf(_SC_PAGESIZE);
+ if (grbuf_size <= 0)
+ grbuf_size = 4096;
+ char grbuf[grbuf_size];
+
grp = NULL;
status = getgrnam_r(group, &sg, grbuf, sizeof(grbuf), &grp);
if (status != 0) {
grp = NULL;
status = getgrnam_r(group, &sg, grbuf, sizeof(grbuf), &grp);
if (status != 0) {