mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-11-30 23:10:23 +00:00
policycoreutils/sandbox: fix debug build
Building from the root directory with "make DEBUG=1" enables -Wshadow option. This makes the compilation fails with the following error: cc -g3 -O0 -gdwarf-2 -fno-strict-aliasing -Wall -Wshadow -Werror -g -I/usr/include -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W -c -o seunshare.o seunshare.c seunshare.c: In function 'spawn_command': seunshare.c:141:6: error: declaration of 'child' shadows a global declaration [-Werror=shadow] int child; ^ seunshare.c:58:12: error: shadowed declaration is here [-Werror=shadow] static int child = 0; ^ Fix this error by renaming the "child" variable in spawn_command. Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
parent
855bfdf0ce
commit
f978b1b071
@ -138,19 +138,19 @@ static int set_signal_handles(void)
|
||||
* TODO: avoid system() and use exec*() instead
|
||||
*/
|
||||
static int spawn_command(const char *cmd, uid_t uid){
|
||||
int child;
|
||||
int childpid;
|
||||
int status = -1;
|
||||
|
||||
if (verbose > 1)
|
||||
printf("spawn_command: %s\n", cmd);
|
||||
|
||||
child = fork();
|
||||
if (child == -1) {
|
||||
childpid = fork();
|
||||
if (childpid == -1) {
|
||||
perror(_("Unable to fork"));
|
||||
return status;
|
||||
}
|
||||
|
||||
if (child == 0) {
|
||||
if (childpid == 0) {
|
||||
if (drop_privs(uid) != 0) exit(-1);
|
||||
|
||||
status = system(cmd);
|
||||
@ -158,7 +158,7 @@ static int spawn_command(const char *cmd, uid_t uid){
|
||||
exit(status);
|
||||
}
|
||||
|
||||
waitpid(child, &status, 0);
|
||||
waitpid(childpid, &status, 0);
|
||||
status_to_retval(status, status);
|
||||
return status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user