Solved

C Programming: Execl permission denied

Posted on 2013-11-18
1
661 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 500 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
port mapped I/o query 10 186
Understanding the meaning of Portability in Embedded System Programming 8 143
sameEnds challenge 3 160
Why isn't object file created? 6 59
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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 opening and writing to files 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.

777 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