ringgaard / sanos

Sanos operating system kernel
Other
69 stars 34 forks source link

Unchecked return value in diplay_line() in edit.c #7

Open longr96 opened 3 years ago

longr96 commented 3 years ago

RTEMS (RTEMS.org) is a free single process, multi-threaded real-time operating system with a long history. Your cool editor (edit.c) has been incorporated into RTEMS as one of the shell commands available. The RTEMS Project is a member of the Coverity Scan program and it flagged an issue in this file. In trying to be good citizens of the wider open source community, the project wants these issues to be reported to the upstream owner along with a fix or suggestions. This is one of those reports.

When Coverity Scan was ran on some of your code, a "Unchecked return value" error was found at line 1050 in src/utils/edit/edit.c. For similar errors that we received for RTEMS, we created a macro that will assert the value returned and "use" the return value like so.

int status;

status = get_selection(ed, &selstart, &selend);
assert(status == 0);
(void)status;

You can just use "(void)get_selection()" if you don't care to check the return value of the function call at all, but this is just a suggestion.

ringgaard commented 3 years ago

I'm happy that you found the Sanos editor useful in your project. I don't really consider it an error in the Sanos code base to ignore a return value, so while I could fix this in this particular place, there will be many other place in the Sanos code base where I would also need to do this.