[naemon-dev] commands.c question

Andreas Ericsson ageric79 at gmail.com
Thu Feb 27 15:40:07 CET 2014


On 2014-02-25 23:15, Daniel Wittenberg wrote:
> I'm curious why we're doing a chdir here, and if so any reason we shouldn't
> be checking the return code to make sure it worked?
> 

The real reason is that on centos 5 the default valgrind would
previously not coredump child processes with unique pid's, so
when I was debugging the command file worker I had to get it to
dump core in a separate directory.

It's not exactly important for the sake of functionality, but it
doesn't hurt either (as we ignore the return values). We could
remove it or keep it. I have no opinion either or, really.

> commands.c:278
> /* we must preserve command_file before nuking memory */
>         (void)chdir("/tmp");
>         (void)chdir("nagios-cfw");
>         str = strdup(command_file);
>         free_memory(get_global_macros());
>         command_file = str;
>         exit(command_file_worker(sv[1]));
> 
> 
> Dan
> 



More information about the Naemon-dev mailing list