mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-21 22:42:29 +00:00
when Konsole terminal exited while nwipe is sitting at the drive selection screen. To avoid 100% CPU usage, check for a runaway condition caused by the function "keystroke = getch() that immediately returns an error condition. We check for an error condition because getch() returns a ERR value when the timeout value "timeout( 250 );" expires as well as when a real error occurs. We can't differentiate from normal operation and a failure of the getch function to block for the specified period of timeout. So here we check the while loop hasn't exceeded the number of expected iterations per second ie. a timeout(250) block value of 250ms means we should not see any more than (1000/250) = 4 iterations. We double this to 8 to allow a little tolerance. Why is this necessary? It's been found that in KDE konsole and other terminals based on the QT terminal engine exiting the terminal without first existing nwipe results in nwipe remaining running but detached from any interface which causes getch to fail and its associated timeout. So the CPU or CPU core rises to 100%. Here we detect that failure and exit nwipe gracefully with the appropriate error. This does not affect use of tmux for attaching or detaching from a running nwipe session when sitting at the selection screen. All other terminals correctly terminate nwipe when the terminal itself is exited.
18 lines
750 B
C
18 lines
750 B
C
/**
|
|
* version_string and program_name are used by siege
|
|
* and configure; author_name and email_address are
|
|
* used by configure to dynamically assign those values
|
|
* to documentation files.
|
|
*/
|
|
const char* version_string = "0.32.026";
|
|
const char* program_name = "nwipe";
|
|
const char* author_name = "Martijn van Brummelen";
|
|
const char* email_address = "git@brumit.nl";
|
|
const char* years = "2022";
|
|
const char* copyright = "Copyright Darik Horn <dajhorn-dban@vanadac.com>\n\
|
|
Modifications to original dwipe Copyright Andy Beverley <andy@andybev.com>\n\
|
|
This is free software; see the source for copying conditions.\n\
|
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\
|
|
FOR A PARTICULAR PURPOSE.\n";
|
|
const char* banner = "nwipe 0.32.026";
|