Module Name: src Committed By: riastradh Date: Mon Mar 14 22:14:19 UTC 2022
Modified Files: src/lib/libc/stdlib: system.c Log Message: system(3): Simplify initialization of argp. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libc/stdlib/system.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/stdlib/system.c diff -u src/lib/libc/stdlib/system.c:1.27 src/lib/libc/stdlib/system.c:1.28 --- src/lib/libc/stdlib/system.c:1.27 Mon Mar 14 22:06:28 2022 +++ src/lib/libc/stdlib/system.c Mon Mar 14 22:14:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: system.c,v 1.27 2022/03/14 22:06:28 riastradh Exp $ */ +/* $NetBSD: system.c,v 1.28 2022/03/14 22:14:19 riastradh Exp $ */ /* * Copyright (c) 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: system.c,v 1.27 2022/03/14 22:06:28 riastradh Exp $"); +__RCSID("$NetBSD: system.c,v 1.28 2022/03/14 22:14:19 riastradh Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -57,12 +57,10 @@ system(const char *command) struct sigaction intsa, quitsa, sa; sigset_t nmask, omask, sigdefault; int pstat; - const char *argp[] = {"sh", "-c", "--", NULL, NULL}; + const char *argp[] = {"sh", "-c", "--", command, NULL}; posix_spawnattr_t attr; int error; - argp[3] = command; - /* * ISO/IEC 9899:1999 in 7.20.4.6 describes this special case. * We need to check availability of a command interpreter.