about summary refs log tree commit diff
path: root/pipeto.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-05-23 15:31:46 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-05-23 15:31:46 +0200
commit3b97f3794e2589a93aa4aa7a503cbb6855edd462 (patch)
treeb0f4439a87b175638824777ba9d12bb50b7e3d00 /pipeto.c
parent94854ad1852527b3ef03b323948c2fd6c63803ef (diff)
downloadmblaze-3b97f3794e2589a93aa4aa7a503cbb6855edd462.tar.gz
mblaze-3b97f3794e2589a93aa4aa7a503cbb6855edd462.tar.xz
mblaze-3b97f3794e2589a93aa4aa7a503cbb6855edd462.zip
pipeto: check argv[0] is set
This path couldn't so far be triggered, but can be useful if we reuse
this code.
Diffstat (limited to 'pipeto.c')
-rw-r--r--pipeto.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pipeto.c b/pipeto.c
index 77982e1..8014584 100644
--- a/pipeto.c
+++ b/pipeto.c
@@ -51,7 +51,10 @@ pipeto(const char *cmdline)
 		}
 		argv[argc] = 0;
 
-		execvp(argv[0], argv);
+		if (argv[0])
+			execvp(argv[0], argv);
+		else
+			errno = EINVAL;
 
 		// execvp failed, write errno to parent
 		long e = errno;