Hi I have a program written in C. I have global variables, arrays, dynamic variables and also arrays etc... I send SIGHUP to my program and in handler I clean up the dynamic memory.And I want to restart my program with HUP.IS there a way to restart the program in c?. I want to exit and return from main in order to clean the memory that are handled by the static arrays in main and restart main.
Hi again. I edited the signal handler and added the execv in the handler. in the handler i have 2 functions. first is clean_up(); that cleans the dynamic arrays and the second is execv(). after sending HUP,first clean_up runs and then execv. but after a small time i have seg fault. but ,when i dont call the clean_up func, then it works fine?is there a problem in cleanup?. but cleanup works fine with other signals,termination signal for example
And a question for execv?.Does not it start the new program from main?.When I call execv, it does not start from main again