mirror of
https://github.com/linux-can/can-utils.git
synced 2026-11-04 15:31:10 +01:00
isobusfs: treat interactive exit as control flow, not error
The cmd_exit() function used -EINTR to signal a clean exit from the interactive mode. This is semantically incorrect because EINTR is an errno value meant for system call interruptions, not application-level control flow. Stop using -EINTR for cmd_exit(). Introduce ISOBUSFS_CLI_RET_EXIT (a positive return code) to distinguish control flow from actual errors. Map this to exit code 0 in main(), keeping negative errno values for real errors. This makes the exit path explicit and prevents confusion with actual interrupted system calls. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user