On Fri, Apr 18, 2014 at 04:00:28PM +0200, Fritjof Bornebusch wrote:
> Hi guys,
> 
> this little diff checks if the chmod call was successful or not.
> 
> Regards,
> Fritjof
> 
> 
> Index: rand/randfile.c
> ===================================================================
> RCS file: /cvs/src/lib/libssl/src/crypto/rand/randfile.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 randfile.c
> --- rand/randfile.c     18 Apr 2014 11:31:16 -0000      1.33
> +++ rand/randfile.c     18 Apr 2014 14:00:05 -0000
> @@ -120,7 +120,9 @@ int RAND_write_file(const char *file)
>                 out = fopen(file,"wb");
>         if (out == NULL) goto err;
>  
> -       chmod(file,0600);
> +       if (chmod(file, 0600) == -1)
> +               goto err;
> +

You would leak "out".

Reyk

Reply via email to