diff options
author | Ian Wienand <ianw@ieee.org> | 2006-02-20 22:44:45 +0100 |
---|---|---|
committer | Ian Wienand <ianw@debian.org> | 2006-02-20 22:44:45 +0100 |
commit | 9a2ad351a1c3215dc596ff3e2e3fd4bc24445a6b (patch) | |
tree | 01bd7628615527758c5a4d0f4242b8cc87508082 /execute_program.c | |
parent | 5570a7769869a4df25ef85f302f74a7feb6c0cd3 (diff) | |
download | ltrace-9a2ad351a1c3215dc596ff3e2e3fd4bc24445a6b.tar.gz |
Switched to SVN (initial import)
Diffstat (limited to 'execute_program.c')
-rw-r--r-- | execute_program.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/execute_program.c b/execute_program.c index 6697386..09db44a 100644 --- a/execute_program.c +++ b/execute_program.c @@ -17,8 +17,8 @@ #include "debug.h" #include "sysdep.h" -static void change_uid(struct process *proc) -{ +static void +change_uid(struct process * proc) { uid_t run_uid, run_euid; gid_t run_gid, run_egid; @@ -26,8 +26,7 @@ static void change_uid(struct process *proc) struct passwd *pent; if (getuid() != 0 || geteuid() != 0) { - fprintf(stderr, - "you must be root to use the -u option\n"); + fprintf(stderr, "you must be root to use the -u option\n"); exit(1); } if ((pent = getpwnam(opt_u)) == NULL) { @@ -69,22 +68,21 @@ static void change_uid(struct process *proc) } } -void execute_program(struct process *sp, char **argv) -{ +void +execute_program(struct process * sp, char **argv) { pid_t pid; debug(1, "Executing `%s'...", sp->filename); pid = fork(); - if (pid < 0) { + if (pid<0) { perror("ltrace: fork"); exit(1); } else if (!pid) { /* child */ change_uid(sp); trace_me(); execvp(sp->filename, argv); - fprintf(stderr, "Can't execute `%s': %s\n", sp->filename, - strerror(errno)); + fprintf(stderr, "Can't execute `%s': %s\n", sp->filename, strerror(errno)); exit(1); } |