You are using the wrong function family. exec() isn't supposed to return.
Use one of the spawn() functions instead.
Hope this helps.
I used spawnl instead of execl, but it gives compile time error
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <mysql/mysql.h>
.....
spawnl(P_WAIT,"/home/user1/exec_work/binary","/home/user1/exec_work/binary","serdar","ilter",NULL);
it says:
`P_WAIT' undeclared (first use in this function)
what header file am i missing? If I put 1 instead of P_WAIT, this time it says that spawnl undeclared.