summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 11893a7)
raw | patch | inline | side by side (parent: 11893a7)
author | Florian Forster <octo@huhu.verplant.org> | |
Fri, 12 Nov 2010 07:13:42 +0000 (08:13 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Fri, 12 Nov 2010 07:13:42 +0000 (08:13 +0100) |
... if the error is ENOENT. This merely means we were too slow and that
we can safely ignore the process.
we can safely ignore the process.
src/processes.c | patch | blob | history |
diff --git a/src/processes.c b/src/processes.c
index 670aa8d717dd19e1e745b1c15584ef2a90c8af3c..856296cc896ab6c4f66e5d67559ab2833b0efe86 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
@@ -903,13 +903,18 @@ static char *ps_get_cmdline (pid_t pid, char *name, char *buf, size_t buf_len)
if ((pid < 1) || (NULL == buf) || (buf_len < 2))
return NULL;
- ssnprintf (file, sizeof (file), "/proc/%u/cmdline", pid);
+ ssnprintf (file, sizeof (file), "/proc/%u/cmdline",
+ (unsigned int) pid);
+ errno = 0;
fd = open (file, O_RDONLY);
if (fd < 0) {
char errbuf[4096];
- WARNING ("processes plugin: Failed to open `%s': %s.", file,
- sstrerror (errno, errbuf, sizeof (errbuf)));
+ /* ENOENT means the process exited while we were handling it.
+ * Don't complain about this, it only fills the logs. */
+ if (errno != ENOENT)
+ WARNING ("processes plugin: Failed to open `%s': %s.", file,
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return NULL;
}
status = read (fd, (void *)buf_ptr, len);
if (status < 0) {
- char errbuf[4096];
+ char errbuf[1024];
if ((EAGAIN == errno) || (EINTR == errno))
continue;