mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
Save errno from close override.
Approved by: pjd (mentor)
This commit is contained in:
parent
0bb5e6ef80
commit
be73922fcd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282258
@ -929,8 +929,10 @@ nvlist_recv(int sock)
|
||||
|
||||
nvl = nvlist_xunpack(buf, size, fds, nfds);
|
||||
if (nvl == NULL) {
|
||||
SAVE_ERRNO(serrno);
|
||||
for (i = 0; i < nfds; i++)
|
||||
close(fds[i]);
|
||||
RESTORE_ERRNO(serrno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -848,6 +848,7 @@ nvpair_t *
|
||||
nvpair_create_descriptor(const char *name, int value)
|
||||
{
|
||||
nvpair_t *nvp;
|
||||
int serrno;
|
||||
|
||||
if (value < 0 || !fd_is_valid(value)) {
|
||||
errno = EBADF;
|
||||
@ -860,8 +861,11 @@ nvpair_create_descriptor(const char *name, int value)
|
||||
|
||||
nvp = nvpair_allocv(name, NV_TYPE_DESCRIPTOR, (uint64_t)value,
|
||||
sizeof(int64_t));
|
||||
if (nvp == NULL)
|
||||
if (nvp == NULL) {
|
||||
SAVE_ERRNO(serrno);
|
||||
close(value);
|
||||
RESTORE_ERRNO(serrno);
|
||||
}
|
||||
|
||||
return (nvp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user