mirror of
https://github.com/tstack/lnav
synced 2024-11-03 23:15:38 +00:00
fix -Wunused-result warnings when calling read() and write()
Fix warnings like these: lnav.cc: In function ‘int main(int, char**)’: lnav.cc:2407:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result] system(pull_cmd); ^ lnav.cc:2966:66: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] write(STDOUT_FILENO, str.c_str(), str.size()); ^ lnav.cc:2967:50: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] write(STDOUT_FILENO, "\n", 1); ^
This commit is contained in:
parent
dc500774a8
commit
04627c1743
25
src/lnav.cc
25
src/lnav.cc
@ -2355,7 +2355,9 @@ int main(int argc, char *argv[])
|
||||
case 'W':
|
||||
{
|
||||
char b;
|
||||
read(STDIN_FILENO, &b, 1);
|
||||
if (read(STDIN_FILENO, &b, 1) == -1) {
|
||||
perror("Read key from STDIN");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2886,8 +2888,11 @@ int main(int argc, char *argv[])
|
||||
++vl, ++y) {
|
||||
while (los != NULL &&
|
||||
los->list_value_for_overlay(*tc, y, al)) {
|
||||
write(STDOUT_FILENO, line.c_str(), line.length());
|
||||
write(STDOUT_FILENO, "\n", 1);
|
||||
if (write(STDOUT_FILENO, line.c_str(),
|
||||
line.length()) == -1 or
|
||||
write(STDOUT_FILENO, "\n", 1) == -1) {
|
||||
perror("write to STDOUT");
|
||||
}
|
||||
++y;
|
||||
}
|
||||
|
||||
@ -2898,9 +2903,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
struct line_range lr = find_string_attr_range(
|
||||
al.get_attrs(), &textview_curses::SA_ORIGINAL_LINE);
|
||||
write(STDOUT_FILENO, lr.substr(al.get_string()),
|
||||
lr.sublen(al.get_string()));
|
||||
write(STDOUT_FILENO, "\n", 1);
|
||||
if (write(STDOUT_FILENO, lr.substr(al.get_string()),
|
||||
lr.sublen(al.get_string())) == -1 or
|
||||
write(STDOUT_FILENO, "\n", 1) == -1) {
|
||||
perror("write to STDOUT");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2956,8 +2963,10 @@ int main(int argc, char *argv[])
|
||||
++line_iter) {
|
||||
lf->read_line(line_iter, str);
|
||||
|
||||
write(STDOUT_FILENO, str.c_str(), str.size());
|
||||
write(STDOUT_FILENO, "\n", 1);
|
||||
if (write(STDOUT_FILENO, str.c_str(), str.size()) == -1 or
|
||||
write(STDOUT_FILENO, "\n", 1) == -1) {
|
||||
perror("write to STDOUT");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user