![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| exec to call specific function in C prog | vpraveen84 | UNIX for Advanced & Expert Users | 2 | 06-03-2008 03:55 PM |
| how to call awk in a csh Program | bikas_jena | Shell Programming and Scripting | 5 | 11-25-2007 05:24 AM |
| exec() system call | a25khan | High Level Programming | 2 | 02-03-2004 12:06 AM |
| need to restrict program exec and running | hachik | UNIX for Dummies Questions & Answers | 1 | 09-16-2002 10:45 AM |
| Exec. commands in python | J.P | Shell Programming and Scripting | 1 | 12-19-2001 04:56 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to run two commands from a exec call in a c program
Hi,
I have to run two commands one after another from a c program. How can i do this with exec system calls. i tried giving them as argument toexecv but it is not working.please help thanks |
|
|||||
|
I'd think about why it's necessary to run that program as setuid root, and if that couldn't be accomplished by other means (eg. sudo) or by using a different approach using as few privileges as possible. IF that isn't possible, you could simulate the system() call by using fork() and wait() (warning: the following is pseudo-code) Code:
function my_system(command)
pid = fork()
if pid == 0 // child
exec(command)
else
wait for pid to exit
my_system(command1);
my_system(command2);
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|