From 3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 21:41:07 +0200 Subject: Merging upstream version 6.7. Signed-off-by: Daniel Baumann --- man3/system.3 | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'man3/system.3') diff --git a/man3/system.3 b/man3/system.3 index 8615623..08ffb07 100644 --- a/man3/system.3 +++ b/man3/system.3 @@ -9,7 +9,7 @@ .\" Modified 14 May 2001, 23 Sep 2001 by aeb .\" 2004-12-20, mtk .\" -.TH system 3 2023-07-20 "Linux man-pages 6.05.01" +.TH system 3 2023-10-31 "Linux man-pages 6.7" .SH NAME system \- execute a shell command .SH LIBRARY @@ -18,7 +18,7 @@ Standard C library .SH SYNOPSIS .nf .B #include -.PP +.P .BI "int system(const char *" "command" ); .fi .SH DESCRIPTION @@ -31,16 +31,16 @@ to create a child process that executed the shell command specified in using .BR execl (3) as follows: -.PP +.P .in +4n .EX execl("/bin/sh", "sh", "\-c", command, (char *) NULL); .EE .in -.PP +.P .BR system () returns after the command has been completed. -.PP +.P During execution of the command, .B SIGCHLD will be blocked, and @@ -52,7 +52,7 @@ will be ignored, in the process that calls (These signals will be handled according to their defaults inside the child process that executes .IR command .) -.PP +.P If .I command is NULL, then @@ -85,7 +85,7 @@ used to execute .IR command . (The termination status of a shell is the termination status of the last command it executes.) -.PP +.P In the last two cases, the return value is a "wait status" that can be examined using the macros described in @@ -94,7 +94,7 @@ the macros described in .BR WIFEXITED (), .BR WEXITSTATUS (), and so on). -.PP +.P .BR system () does not affect the wait status of any other children. .SH ERRORS @@ -115,7 +115,6 @@ T{ .BR system () T} Thread safety MT-Safe .TE -.sp 1 .SH STANDARDS C11, POSIX.1-2008. .SH HISTORY @@ -137,7 +136,7 @@ The main cost of is inefficiency: additional system calls are required to create the process that runs the shell and to execute the shell. -.PP +.P If the .B _XOPEN_SOURCE feature test macro is defined @@ -149,7 +148,7 @@ then the macros described in .RB ( WEXITSTATUS (), etc.) are made available when including .IR . -.PP +.P As mentioned, .BR system () ignores @@ -160,7 +159,7 @@ This may make programs that call it from a loop uninterruptible, unless they take care themselves to check the exit status of the child. For example: -.PP +.P .in +4n .EX while (something) { @@ -172,13 +171,13 @@ while (something) { } .EE .in -.PP +.P According to POSIX.1, it is unspecified whether handlers registered using .BR pthread_atfork (3) are called during the execution of .BR system (). In the glibc implementation, such handlers are not called. -.PP +.P Before glibc 2.1.3, the check for the availability of .I /bin/sh was not actually performed if @@ -192,7 +191,7 @@ a shell, that shell may not be available or executable if the calling program has previously called .BR chroot (2) (which is not specified by POSIX.1-2001). -.PP +.P It is possible for the shell command to terminate with a status of 127, which yields a .BR system () @@ -219,7 +218,7 @@ or (which also use the .B PATH environment variable to search for an executable). -.PP +.P .BR system () will not, in fact, work properly from programs with set-user-ID or set-group-ID privileges on systems on which @@ -229,7 +228,7 @@ is bash version 2: as a security measure, bash 2 drops privileges on startup. .BR dash (1), which does not do this when invoked as .BR sh .) -.PP +.P Any user input that is employed as part of .I command should be @@ -253,7 +252,7 @@ option to .BR sh (1).) To work around this problem, prepend the command with a space as in the following call: -.PP +.P .in +4n .EX system(" \-unfortunate\-command\-name"); -- cgit v1.2.3