----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/46373/#review133690 -----------------------------------------------------------
src/files/files.cpp (lines 374 - 376) <https://reviews.apache.org/r/46373/#comment198281> How about: "The pailer in the webui sends `length=-1` at first to determine the length of the file, so we allow a length of -1. Setting `length=-1` has the same effect as not providing a length: we read to the end of the file, up to the maximum read length." src/files/files.cpp (lines 378 - 383) <https://reviews.apache.org/r/46373/#comment198278> What do you think about: `if (result.get() < -1) { ... }` `if (result.get() > -1) { ... }` I think that might improve readability a bit? src/tests/files_tests.cpp (lines 175 - 176) <https://reviews.apache.org/r/46373/#comment198282> How about: "The pailer in the webui will send `length=-1` at first to determine the length of the file, so we need to accept a length of -1." - Greg Mann On May 17, 2016, 5:29 a.m., zhou xing wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/46373/ > ----------------------------------------------------------- > > (Updated May 17, 2016, 5:29 a.m.) > > > Review request for mesos, Benjamin Mahler and Greg Mann. > > > Bugs: mesos-5060 > https://issues.apache.org/jira/browse/mesos-5060 > > > Repository: mesos > > > Description > ------- > > [MESOS-5060] > The patch did the following changes: > 1. Fix the length logic in files.cpp. > 2. Add some tests to test the /files/read.json endponit with > negative length. > > > Diffs > ----- > > src/files/files.cpp e4b0ada00aabba6553810391f4015a896f8a69a5 > src/tests/files_tests.cpp 5d6620d13babaf0bb7f9c888bb1b4fa2228b6ccd > > Diff: https://reviews.apache.org/r/46373/diff/ > > > Testing > ------- > > make > make check > > request 'files/read.json' endpoint with negative offset or length argument > > > Thanks, > > zhou xing > >
