isobusfs: treat interactive exit as control flow, not error
Stop using -EINTR for cmd_exit(). Introduce ISOBUSFS_CLI_RET_EXIT and map it to exit code 0 in main(), keeping errno values for real errors. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>pull/615/head
parent
4feccd5889
commit
cdc00bacf0
|
|
@ -671,6 +671,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = isobusfs_cli_process_events_and_tasks(priv);
|
ret = isobusfs_cli_process_events_and_tasks(priv);
|
||||||
|
if (ret == ISOBUSFS_CLI_RET_EXIT) {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@
|
||||||
#define ISOBUSFS_CLI_MAX_EPOLL_EVENTS 10
|
#define ISOBUSFS_CLI_MAX_EPOLL_EVENTS 10
|
||||||
#define ISOBUSFS_CLI_DEFAULT_WAIT_TIMEOUT_MS 1000 /* ms */
|
#define ISOBUSFS_CLI_DEFAULT_WAIT_TIMEOUT_MS 1000 /* ms */
|
||||||
|
|
||||||
|
/* internel return codes, not errno values */
|
||||||
|
#define ISOBUSFS_CLI_RET_EXIT 1
|
||||||
|
|
||||||
enum isobusfs_cli_state {
|
enum isobusfs_cli_state {
|
||||||
ISOBUSFS_CLI_STATE_CONNECTING,
|
ISOBUSFS_CLI_STATE_CONNECTING,
|
||||||
ISOBUSFS_CLI_STATE_IDLE,
|
ISOBUSFS_CLI_STATE_IDLE,
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ static int cmd_help(struct isobusfs_priv *priv, const char *options)
|
||||||
static int cmd_exit(struct isobusfs_priv *priv, const char *options)
|
static int cmd_exit(struct isobusfs_priv *priv, const char *options)
|
||||||
{
|
{
|
||||||
pr_int("exit interactive mode\n");
|
pr_int("exit interactive mode\n");
|
||||||
/* Return -EINTR to indicate the program should exit */
|
|
||||||
return -EINTR;
|
return ISOBUSFS_CLI_RET_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmd_dmesg(struct isobusfs_priv *priv, const char *options)
|
static int cmd_dmesg(struct isobusfs_priv *priv, const char *options)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue