From: Michal Privoznik Date: Fri, 20 Aug 2021 08:41:41 +0000 (+0200) Subject: virsocket: Don't preserve errno in virSocketRecvFD() X-Git-Tag: v7.7.0-rc1~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f33a6dcb47ef513275dcaa7b749d8ffd596470e;p=thirdparty%2Flibvirt.git virsocket: Don't preserve errno in virSocketRecvFD() When setting O_CLOEXEC flag on received FD fails the FD is closed using VIR_FORCE_CLOSE(). But the call is wrapped in errno save which is not necessary because VIR_FORCE_CLOSE() preserves errno value. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/util/virsocket.c b/src/util/virsocket.c index b971da16e3..a6f185114d 100644 --- a/src/util/virsocket.c +++ b/src/util/virsocket.c @@ -477,9 +477,7 @@ virSocketRecvFD(int sock, int fdflags) /* set close-on-exec flag */ if (!MSG_CMSG_CLOEXEC && (fdflags & O_CLOEXEC)) { if (virSetCloseExec(fd) < 0) { - int saved_errno = errno; VIR_FORCE_CLOSE(fd); - errno = saved_errno; return -1; } }