forked from RepoMirrors/bemenu
1475c3ce45
The previous version of this code operated under the assumption that getline(3) lines are always \n\0 terminated. Unfortunately, this is not the case as readline will return input which is not terminated with a newline character if EOF is reached before encountering this newline. In these cases, the code would falsely strip the last character. As an example, consider the following bemenu invocation: printf foo | ./bemenu This would start bemenu with `fo` instead of `foo` as a menu item. This commit fixes this edge case and also hardens the loop body a bit by only entering it if getline wrote more than zero characters to the buffer. |
||
---|---|---|
.. | ||
common | ||
bemenu-run.c | ||
bemenu.c |