projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed gcc 7 format-truncation errors #2423
[collectd.git]
/
src
/
battery.c
diff --git
a/src/battery.c
b/src/battery.c
index
5a0b089
..
b6dea0f
100644
(file)
--- a/
src/battery.c
+++ b/
src/battery.c
@@
-347,8
+347,7
@@
static int sysfs_file_to_buffer(char const *dir, /* {{{ */
char filename[PATH_MAX];
int status;
char filename[PATH_MAX];
int status;
- ssnprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
- basename);
+ snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply, basename);
status = (int)read_file_contents(filename, buffer, buffer_size - 1);
if (status < 0)
status = (int)read_file_contents(filename, buffer, buffer_size - 1);
if (status < 0)
@@
-479,7
+478,7
@@
static int read_acpi_full_capacity(char const *dir, /* {{{ */
FILE *fh;
FILE *fh;
- s
s
nprintf(filename, sizeof(filename), "%s/%s/info", dir, power_supply);
+ snprintf(filename, sizeof(filename), "%s/%s/info", dir, power_supply);
fh = fopen(filename, "r");
if (fh == NULL)
return errno;
fh = fopen(filename, "r");
if (fh == NULL)
return errno;
@@
-532,7
+531,7
@@
static int read_acpi_callback(char const *dir, /* {{{ */
FILE *fh;
FILE *fh;
- s
s
nprintf(filename, sizeof(filename), "%s/%s/state", dir, power_supply);
+ snprintf(filename, sizeof(filename), "%s/%s/state", dir, power_supply);
fh = fopen(filename, "r");
if (fh == NULL) {
if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
fh = fopen(filename, "r");
if (fh == NULL) {
if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
@@
-641,11
+640,11
@@
static int read_pmu(void) /* {{{ */
gauge_t voltage = NAN;
gauge_t charge = NAN;
gauge_t voltage = NAN;
gauge_t charge = NAN;
- s
s
nprintf(filename, sizeof(filename), PROC_PMU_PATH_FORMAT, i);
+ snprintf(filename, sizeof(filename), PROC_PMU_PATH_FORMAT, i);
if (access(filename, R_OK) != 0)
break;
if (access(filename, R_OK) != 0)
break;
- s
s
nprintf(plugin_instance, sizeof(plugin_instance), "%i", i);
+ snprintf(plugin_instance, sizeof(plugin_instance), "%i", i);
fh = fopen(filename, "r");
if (fh == NULL) {
fh = fopen(filename, "r");
if (fh == NULL) {