summaryrefslogtreecommitdiff
path: root/src/readahead
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-12 12:15:49 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-13 17:56:54 -0400
commitb47d419c25ecc735615a1088060c1ec8bef1e41f (patch)
tree13940040841fbec3a928f82426390654e4b50fcc /src/readahead
parent7ff7394d9e4e9189c30fd018235e6b1728c6f2d0 (diff)
Modernization
Fixes minor leak in error path in device.c.
Diffstat (limited to 'src/readahead')
-rw-r--r--src/readahead/readahead-collect.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 6b748664c3..58b77bdcf7 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -415,7 +415,8 @@ static int collect(const char *root) {
}
}
- if ((n = read(fanotify_fd, &data, sizeof(data))) < 0) {
+ n = read(fanotify_fd, &data, sizeof(data));
+ if (n < 0) {
if (errno == EINTR || errno == EAGAIN)
continue;
@@ -436,7 +437,7 @@ static int collect(const char *root) {
}
for (m = &data.metadata; FAN_EVENT_OK(m, n); m = FAN_EVENT_NEXT(m, n)) {
- char fn[PATH_MAX];
+ char fn[sizeof("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
int k;
if (m->fd < 0)
@@ -450,9 +451,8 @@ static int collect(const char *root) {
goto next_iteration;
snprintf(fn, sizeof(fn), "/proc/self/fd/%i", m->fd);
- char_array_0(fn);
-
- if ((k = readlink_malloc(fn, &p)) >= 0) {
+ k = readlink_malloc(fn, &p);
+ if (k >= 0) {
if (startswith(p, "/tmp") ||
endswith(p, " (deleted)") ||
hashmap_get(files, p))