projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Format BSD constrained sysctl usage
[collectd.git]
/
src
/
collectdctl.c
diff --git
a/src/collectdctl.c
b/src/collectdctl.c
index
1ced583
..
3974fd0
100644
(file)
--- a/
src/collectdctl.c
+++ b/
src/collectdctl.c
@@
-81,8
+81,7
@@
extern char *optarg;
extern int optind;
extern char *optarg;
extern int optind;
-/* ssnprintf returns zero on success, one if truncation occurred
- and a negative integer onerror. */
+/* _ssnprintf returns result from vsnprintf (consistent with snprintf) */
static int _ssnprintf(char *str, size_t sz, const char *format, ...) {
va_list ap;
va_start(ap, format);
static int _ssnprintf(char *str, size_t sz, const char *format, ...) {
va_list ap;
va_start(ap, format);
@@
-91,10
+90,7
@@
static int _ssnprintf(char *str, size_t sz, const char *format, ...) {
va_end(ap);
va_end(ap);
- if (ret < 0) {
- return ret;
- }
- return (size_t)ret >= sz;
+ return ret;
} /* int _ssnprintf */
__attribute__((noreturn)) static void exit_usage(const char *name, int status) {
} /* int _ssnprintf */
__attribute__((noreturn)) static void exit_usage(const char *name, int status) {
@@
-293,8
+289,9
@@
static int flush(lcc_connection_t *c, int argc, char **argv) {
value);
BAIL_OUT(-1);
} else if ((endptr != NULL) && (*endptr != '\0')) {
value);
BAIL_OUT(-1);
} else if ((endptr != NULL) && (*endptr != '\0')) {
- fprintf(stderr, "WARNING: Ignoring trailing garbage after timeout: "
- "%s.\n",
+ fprintf(stderr,
+ "WARNING: Ignoring trailing garbage after timeout: "
+ "%s.\n",
endptr);
}
} else if (strcasecmp(key, "plugin") == 0) {
endptr);
}
} else if (strcasecmp(key, "plugin") == 0) {
@@
-341,8
+338,9
@@
static int flush(lcc_connection_t *c, int argc, char **argv) {
char id[1024];
lcc_identifier_to_string(c, id, sizeof(id), identifiers + j);
char id[1024];
lcc_identifier_to_string(c, id, sizeof(id), identifiers + j);
- fprintf(stderr, "ERROR: Failed to flush plugin `%s', "
- "identifier `%s': %s.\n",
+ fprintf(stderr,
+ "ERROR: Failed to flush plugin `%s', "
+ "identifier `%s': %s.\n",
(plugins[i] == NULL) ? "(all)" : plugins[i], id,
lcc_strerror(c));
}
(plugins[i] == NULL) ? "(all)" : plugins[i], id,
lcc_strerror(c));
}
@@
-386,8
+384,9
@@
static int listval(lcc_connection_t *c, int argc, char **argv) {
status = lcc_identifier_to_string(c, id, sizeof(id), ret_ident + i);
if (status != 0) {
status = lcc_identifier_to_string(c, id, sizeof(id), ret_ident + i);
if (status != 0) {
- fprintf(stderr, "ERROR: listval: Failed to convert returned "
- "identifier to a string: %s\n",
+ fprintf(stderr,
+ "ERROR: listval: Failed to convert returned "
+ "identifier to a string: %s\n",
lcc_strerror(c));
continue;
}
lcc_strerror(c));
continue;
}
@@
-445,8
+444,9
@@
static int putval(lcc_connection_t *c, int argc, char **argv) {
value);
return -1;
} else if ((endptr != NULL) && (*endptr != '\0')) {
value);
return -1;
} else if ((endptr != NULL) && (*endptr != '\0')) {
- fprintf(stderr, "WARNING: Ignoring trailing garbage after "
- "interval: %s.\n",
+ fprintf(stderr,
+ "WARNING: Ignoring trailing garbage after "
+ "interval: %s.\n",
endptr);
}
} else {
endptr);
}
} else {