]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsocket: Don't preserve errno in virSocketRecvFD()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 20 Aug 2021 08:41:41 +0000 (10:41 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 20 Aug 2021 13:00:53 +0000 (15:00 +0200)
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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virsocket.c

index b971da16e3737bc453f2fa38d5533a8d60ea0a52..a6f185114d24ce6781970385f48b7970c71a5576 100644 (file)
@@ -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;
         }
     }