projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treewide: replace ssnprintf with snprintf
[collectd.git]
/
src
/
processes.c
diff --git
a/src/processes.c
b/src/processes.c
index
82a4859
..
17918c4
100644
(file)
--- a/
src/processes.c
+++ b/
src/processes.c
@@
-805,7
+805,7
@@
static int ps_read_tasks_status(process_entry_t *ps) {
char *fields[8];
int numfields;
char *fields[8];
int numfields;
- s
s
nprintf(dirname, sizeof(dirname), "/proc/%li/task", ps->id);
+ snprintf(dirname, sizeof(dirname), "/proc/%li/task", ps->id);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
@@
-820,7
+820,7
@@
static int ps_read_tasks_status(process_entry_t *ps) {
tpid = ent->d_name;
tpid = ent->d_name;
- s
s
nprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
+ snprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
tpid);
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("Failed to open file `%s'", filename);
tpid);
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("Failed to open file `%s'", filename);
@@
-878,7
+878,7
@@
static int ps_read_status(long pid, process_entry_t *ps) {
char *fields[8];
int numfields;
char *fields[8];
int numfields;
- s
s
nprintf(filename, sizeof(filename), "/proc/%li/status", pid);
+ snprintf(filename, sizeof(filename), "/proc/%li/status", pid);
if ((fh = fopen(filename, "r")) == NULL)
return -1;
if ((fh = fopen(filename, "r")) == NULL)
return -1;
@@
-931,7
+931,7
@@
static int ps_read_io(process_entry_t *ps) {
char *fields[8];
int numfields;
char *fields[8];
int numfields;
- s
s
nprintf(filename, sizeof(filename), "/proc/%li/io", ps->id);
+ snprintf(filename, sizeof(filename), "/proc/%li/io", ps->id);
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("ps_read_io: Failed to open file `%s'", filename);
return -1;
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("ps_read_io: Failed to open file `%s'", filename);
return -1;
@@
-980,7
+980,7
@@
static int ps_count_fd(int pid) {
struct dirent *ent;
int count = 0;
struct dirent *ent;
int count = 0;
- s
s
nprintf(dirname, sizeof(dirname), "/proc/%i/fd", pid);
+ snprintf(dirname, sizeof(dirname), "/proc/%i/fd", pid);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
@@
-1041,7
+1041,7
@@
static int ps_read_process(long pid, process_entry_t *ps, char *state) {
ssize_t status;
ssize_t status;
- s
s
nprintf(filename, sizeof(filename), "/proc/%li/stat", pid);
+ snprintf(filename, sizeof(filename), "/proc/%li/stat", pid);
status = read_file_contents(filename, buffer, sizeof(buffer) - 1);
if (status <= 0)
status = read_file_contents(filename, buffer, sizeof(buffer) - 1);
if (status <= 0)
@@
-1165,7
+1165,7
@@
static char *ps_get_cmdline(long pid, char *name, char *buf, size_t buf_len) {
if ((pid < 1) || (NULL == buf) || (buf_len < 2))
return NULL;
if ((pid < 1) || (NULL == buf) || (buf_len < 2))
return NULL;
- s
s
nprintf(file, sizeof(file), "/proc/%li/cmdline", pid);
+ snprintf(file, sizeof(file), "/proc/%li/cmdline", pid);
errno = 0;
fd = open(file, O_RDONLY);
errno = 0;
fd = open(file, O_RDONLY);
@@
-1220,7
+1220,7
@@
static char *ps_get_cmdline(long pid, char *name, char *buf, size_t buf_len) {
if (NULL == name)
return NULL;
if (NULL == name)
return NULL;
- s
s
nprintf(buf, buf_len, "[%s]", name);
+ snprintf(buf, buf_len, "[%s]", name);
return buf;
}
return buf;
}