Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C Programming: Execl permission denied

Posted on 2013-11-18
1
Medium Priority
?
749 Views
Last Modified: 2013-11-18
I am new to C programming. Is this the right use of the execl command?

void communicate(const char *port, const char *conf, const char *cwd) {
   ...
   // cwd is /home/users1/pz951772
   execl(cwd,"egress");
   ...
}

egrass.c is a simple C program, that has been GCC'd (gcc -o egress egress.c)
I also did "chmod 777 egress" thinking that I should give it full rights, but that didn't help.

If needed I can post the entire code.
0
Comment
Question by:pzozulka
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 39657116
If you want to launch a program called 'egress', that shoule be more like

 chdir(cwd);
 execl("egress","egress");

Open in new window


See also http://linux.die.net/man/3/execl - the first argument to 'execl()' is th eprograms name, the 2nd the 1st argument to the program, which in turn is equal to the program's name. In your snippet, you were trying to run 'cwd', which does not work and causes that error.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question