diff mbox series

[BlueZ,2/2] tools/rfcomm: _exit() on execvp() failure

Message ID 20240215083954.5233-2-matthias.schiffer@ew.tq-group.com (mailing list archive)
State Accepted
Commit f79ccf6c429ed28e5aac8c68ed818aa2d7d5351d
Headers show
Series [BlueZ,1/2] tools/rfcomm: reset ignored signals after fork | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Matthias Schiffer Feb. 15, 2024, 8:39 a.m. UTC
When the exec fails, the child process must be terminated instead of
continuing as a second main process.
---
 tools/rfcomm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/rfcomm.c b/tools/rfcomm.c
index f635d4aef..0139fe69b 100644
--- a/tools/rfcomm.c
+++ b/tools/rfcomm.c
@@ -234,7 +234,7 @@  static void run_cmdline(struct pollfd *p, sigset_t *sigs, char *devname,
 		i = execvp(cmdargv[0], cmdargv);
 		fprintf(stderr, "Couldn't execute command %s (errno=%d:%s)\n",
 				cmdargv[0], errno, strerror(errno));
-		break;
+		_exit(EXIT_FAILURE);
 	case -1:
 		fprintf(stderr, "Couldn't fork to execute command %s\n",
 				cmdargv[0]);