[ofa-general] [PATCH] opensm: chdir to / in the daemon mode

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sun Mar 25 04:02:48 PDT 2007


Sasha Khapyorsky wrote:
> Change working directory to "/" when running in the daemon mode. It is
> in order to not keep the filesystem busy and prevent potential umount
> failures.
> 
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  osm/opensm/main.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/osm/opensm/main.c b/osm/opensm/main.c
> index 3f465e9..d5c3699 100644
> --- a/osm/opensm/main.c
> +++ b/osm/opensm/main.c
> @@ -548,6 +548,8 @@ static int daemonize(osm_opensm_t *osm)
>  	} else if (pid > 0)
>  		exit(0);
>  
> +	chdir("/");

What if there is a coredump? Wouldn't it be better to chdir
to /tmp/ instead ?

-- Yevgeny

> +
>  	close(0);
>  	close(1);
>  	close(2);




More information about the general mailing list