projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename LTTng index in CTF index
[lttng-tools.git]
/
src
/
common
/
sessiond-comm
/
inet.c
diff --git
a/src/common/sessiond-comm/inet.c
b/src/common/sessiond-comm/inet.c
index fa9218769b31c1d903e9cd33e6c12c0e3fbe0bd5..2c959c5fe81ee08d21cca8f0ac42a62d0dfecb6c 100644
(file)
--- a/
src/common/sessiond-comm/inet.c
+++ b/
src/common/sessiond-comm/inet.c
@@
-457,6
+457,7
@@
int lttcomm_close_inet_sock(struct lttcomm_sock *sock)
static unsigned long read_proc_value(const char *path)
{
int ret, fd;
static unsigned long read_proc_value(const char *path)
{
int ret, fd;
+ ssize_t size_ret;
long r_val;
unsigned long val = 0;
char buf[64];
long r_val;
unsigned long val = 0;
char buf[64];
@@
-466,11
+467,16
@@
static unsigned long read_proc_value(const char *path)
goto error;
}
goto error;
}
- ret = read(fd, buf, sizeof(buf));
- if (ret < 0) {
+ size_ret = lttng_read(fd, buf, sizeof(buf));
+ /*
+ * Allow reading a file smaller than buf, but keep space for
+ * final \0.
+ */
+ if (size_ret < 0 || size_ret >= sizeof(buf)) {
PERROR("read proc failed");
goto error_close;
}
PERROR("read proc failed");
goto error_close;
}
+ buf[size_ret] = '\0';
errno = 0;
r_val = strtol(buf, NULL, 10);
errno = 0;
r_val = strtol(buf, NULL, 10);
This page took
0.02935 seconds
and
5
git commands to generate.