[CinCV TNG] [PATCH] Fixed compiler warnings in filesystem.C

Johannes Sixt j6t at kdbg.org
Sun Jul 2 13:46:47 CEST 2017


Am 30.06.2017 um 22:03 schrieb Einar R√ľnkaru:
> Fixed warnings about ignored return value.
> ---
>   guicast/filesystem.C | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/guicast/filesystem.C b/guicast/filesystem.C
> index be4e3d9..8d84cec 100644
> --- a/guicast/filesystem.C
> +++ b/guicast/filesystem.C
> @@ -101,8 +101,11 @@ int FileItem::set_name(char *name)
>   FileSystem::FileSystem()
>   {
>   	reset_parameters();
> -	getcwd(current_dir, BCTEXTLEN);
> -	
> +	if(!getcwd(current_dir, BCTEXTLEN))
> +	{
> +		perror("get current working directory");
> +		abort();
> +	}
>   }
>   
>   FileSystem::~FileSystem()

We need a different solution for this case. You can't abort here. It is 
well possible to remove a parent director of the current directory. Then 
getcwd() will fail. This would crash Cinelerra.

Without this patch, current_dir remains unchanged when getcwd() fails. 
It basically leaves random stuff in current_dir. A possible solution is 
to set current_dir to an empty string so that there is at the least some 
predictable value.

-- Hannes


More information about the Cinelerra mailing list