changeset 2:a5bab86d0573

vspawn: fix invalid first argument
author David Demelier <markand@malikania.fr>
date Wed, 04 Aug 2021 10:34:16 +0200
parents ede8860cd261
children 7916dd39a513
files vspawn.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/vspawn.c	Thu Jul 29 16:36:33 2021 +0200
+++ b/vspawn.c	Wed Aug 04 10:34:16 2021 +0200
@@ -141,7 +141,6 @@
 
 	pid_t pid;
 	int pidfd;
-	char *exec = argv[0];
 
 	if ((pid = parsepid()) != -1)
 		die("abort: already running with pid %d\n", (int)pid);
@@ -161,9 +160,7 @@
 		close(pidfd);
 	}
 
-	/* We need to pass executable to first argument too. */
-	*--argv = exec;
-	execv(exec, argv);
+	execv(argv[0], argv);
 	die("abort: %s\n", strerror(errno));
 }