mirror of
https://github.com/samba-team/samba.git
synced 2025-02-01 05:47:28 +03:00
s3-vfs: Don't leak file descriptor on error.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
parent
6213606771
commit
c647169e28
@ -73,8 +73,10 @@ static int copy_reg(const char *source, const char *dest)
|
||||
if((ifd = open (source, O_RDONLY, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
if (unlink (dest) && errno != ENOENT)
|
||||
if (unlink (dest) && errno != ENOENT) {
|
||||
close(ifd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef O_NOFOLLOW
|
||||
if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user