Questions tagged [execve]
207 questions
-1
votes
1 answer
How a program that uses two child process stop, while first child is not done yet
This is the program
The program is an implementation of pipe ( | )
#include
#include
int main(int ac, char **av, char **env)
{
int end[2];
int file[2];
char **cmd1;
char **cmd2;
int status;
file[0] =…

Taha Exo
- 1
- 1
-1
votes
1 answer
linux, how to fork and exec a process whose stdout can be read by the parent process
I can't figure out how to exec a process and read its stdout. It seems like this should be a combination of fork() and execve(), but I can't figure out how to get the pipes connected.
I know how to create a pipe and fork, and read the pipe written…

Gary Aitken
- 233
- 2
- 12
-1
votes
1 answer
File descriptors not properly passed to processes generated with execve() system call
I'm reading a unix book and specifically the part about execve() system call. The book says that file descriptors related to opened file are passed to child processes and also ( default behaviour ) after a process calls execve().
However, when I…

Kode1000
- 111
- 3
-1
votes
1 answer
child process infinite loop with execve
Here is my pipe to pipe function:
int *pip is the pipe that I want to read from
char **cmd is the command that I want to execute
char **envp points to the environment variables
I want to take the pipe (pip) as STDIN with dup2
and take the new pipe…

Maxou
- 37
- 5
-1
votes
1 answer
Binary create a shell as another user
I have a specific question,
I have a binary that launch a shell with execv but the shell change the user and with gdb i can't seem to find where the user change is happening.
level0@RainFall:~$ whoami
level0
level0@RainFall:~$ ls -la
-rwsr-x---+ 1…

Sjorinn
- 3
- 1
-1
votes
1 answer
Performing arithmetics with execve from arguments passed by terminal
Trying to understand how to perform an arithmetic operation from arguments passed from terminal and use them in execve ?
./myProgram 'echo "$1+$2=$(($1+$2))"' 3 5
this is suppose to give me an output of 8
what i've tried manually without argv…

ZeivRine
- 183
- 2
- 4
-1
votes
1 answer
char *const argv[] vs char *argv and execv system call
int main(void)
{
int e;
char *envp[] = {NULL};
char *argv[] = {"/bin/ls", "-1",NULL};
//char *argv[] = {"/bin/ls", "-1",NULL};
argv[1]= "0";;
//e = …

akshay
- 1
-1
votes
2 answers
Executing a Python command with a setuid/setgid wrapper
I have the following Python script that I'd like to execute with the permissions afforded by the setuid/setgid bit:
#!/usr/bin/env python3
from mypackage.cli import main as cli_main
cli_main()
However: I would like execute the command directly from…

DanielGibbs
- 9,910
- 11
- 76
- 121
-1
votes
1 answer
Compiler bug cause execve to fail?
I'm experiencing something mysterious with a C program which works fine on my pc but fails when I compile it on the server I'm working on. Basically the execution of execve fails. The original program is not too big so I started to cut some parts in…

TTK
- 223
- 6
- 21
-2
votes
1 answer
How to add pointer to pointer array in C
I am trying to create a simple shell in C. I am having issues with using the execve() function. So I have my arguments declared as char *cmdargs[10]; which holds the arguments such as -a or -l. However, it does not work with my execute function and…

We Que
- 5
- 3
-2
votes
1 answer
fork() and Execve, minix system C, core dumps
I'm learning C at the moment and have tasked myself with creating a shell within a Minix virtual machine, I'm doing this by using the library functions available to me already in Minix, such as ls, cd, ect...
I've encountered a problem where after…

Ben Bowen
- 174
- 1
- 13
-2
votes
2 answers
Linux user-space ELF loader after fork extremely strange behavior
Consider the following code (revisited to compile due to public demand :):
#include
#include
#include
#include
#include
#include
#include
#include…

nimi
- 106
- 6