mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
astfd.c: Avoid calling fclose with NULL argument.
Don't pass through a NULL argument to fclose, which is undefined
behavior, and instead return -1 and set errno appropriately. This
also avoids a compiler warning with glibc 2.38 and newer, as glibc
commit 71d9e0fe766a3c22a730995b9d024960970670af
added the nonnull attribute to this argument.
Resolves: #900
(cherry picked from commit 7c982de5c6
)
This commit is contained in:
committed by
Asterisk Development Team
parent
7147440560
commit
10963cd27e
@@ -280,7 +280,8 @@ int __ast_fdleak_fclose(FILE *ptr)
|
||||
{
|
||||
int fd, res;
|
||||
if (!ptr) {
|
||||
return fclose(ptr);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = fileno(ptr);
|
||||
|
Reference in New Issue
Block a user