Solved

C Programming: Execl permission denied

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now