summaryrefslogtreecommitdiff
path: root/src/coredump
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-05-11 15:29:24 +0300
committerLennart Poettering <lennart@poettering.net>2016-05-11 14:29:24 +0200
commitfe1ef0f86e49c50cf71579d98679973a6d671323 (patch)
tree52c456947cb88ed1fa69a44ba43ad4854952071a /src/coredump
parent4b273d46bb939d03757fdf1a932d3811633e0cdf (diff)
coredump: use next_datagram_size_fd instead of ioctl(FIONREAD) (#3237)
We need to be sure that the size returned here actually matches what we will read with recvmsg() next Fixes #2984
Diffstat (limited to 'src/coredump')
-rw-r--r--src/coredump/coredump.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index 01fdcfa909..999de63900 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -739,15 +739,16 @@ static int process_socket(int fd) {
.msg_iovlen = 1,
};
ssize_t n;
- int l;
+ ssize_t l;
if (!GREEDY_REALLOC(iovec, n_iovec_allocated, n_iovec + 3)) {
r = log_oom();
goto finish;
}
- if (ioctl(fd, FIONREAD, &l) < 0) {
- r = log_error_errno(errno, "FIONREAD failed: %m");
+ l = next_datagram_size_fd(fd);
+ if (l < 0) {
+ r = log_error_errno(l, "Failed to determine datagram size to read: %m");
goto finish;
}