diff mbox series

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

Message ID 20240215083954.5233-2-matthias.schiffer@ew.tq-group.com
State New
Headers show
Series [BlueZ,1/2] tools/rfcomm: reset ignored signals after fork | expand

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]);