Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666333
| From | Michael Sartain <mikesart@fastmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 4/6] Fix read / write data offsets in read / write loops |
| Date | 2017-06-15 02:30 +0200 |
| Message-ID | <tSqPE-3IL-17@gated-at.bofh.it> (permalink) |
| References | <tSqPD-3IL-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The tot variable in __do_write and do_read is incremented with the amount read
/ written, but subsequent times through the loop the calls continue to use the
original data pointer.
Signed-off-by: Michael Sartain <mikesart@fastmail.com>
---
trace-cmd-local.h | 2 +-
trace-input.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/trace-cmd-local.h b/trace-cmd-local.h
index 8595a8a..b8ab35b 100644
--- a/trace-cmd-local.h
+++ b/trace-cmd-local.h
@@ -31,7 +31,7 @@ static ssize_t __do_write(int fd, const void *data, size_t size)
ssize_t w;
do {
- w = TEMP_FAILURE_RETRY(write(fd, data, size - tot));
+ w = TEMP_FAILURE_RETRY(write(fd, data + tot, size - tot));
tot += w;
if (!w)
diff --git a/trace-input.c b/trace-input.c
index 251d32b..8395917 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -202,7 +202,7 @@ static ssize_t do_read(struct tracecmd_input *handle, void *data, size_t size)
ssize_t r;
do {
- r = TEMP_FAILURE_RETRY(read(handle->fd, data, size - tot));
+ r = TEMP_FAILURE_RETRY(read(handle->fd, data + tot, size - tot));
tot += r;
if (!r)
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v3 0/6] trace-cmd: escape sequence, EINTR, error checking bug fixes Michael Sartain <mikesart@fastmail.com> - 2017-06-15 02:30 +0200 [PATCH v3 6/6] Fix cases where string literals were passed as string format args Michael Sartain <mikesart@fastmail.com> - 2017-06-15 02:30 +0200 [PATCH v3 2/6] Fix unsigned return values being error checked as negative Michael Sartain <mikesart@fastmail.com> - 2017-06-15 02:30 +0200 [PATCH v3 5/6] Fix function prototypes for __vwarning, __vpr_stat, and __vdie Michael Sartain <mikesart@fastmail.com> - 2017-06-15 02:30 +0200 [PATCH v3 4/6] Fix read / write data offsets in read / write loops Michael Sartain <mikesart@fastmail.com> - 2017-06-15 02:30 +0200
csiph-web