]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix spurious errors from kcmio_unix_socket_write
authorRobbie Harwood <rharwood@redhat.com>
Mon, 5 Nov 2018 18:49:52 +0000 (13:49 -0500)
committerGreg Hudson <ghudson@mit.edu>
Mon, 5 Nov 2018 22:54:47 +0000 (17:54 -0500)
Commit 33634a940166d0b21c3105bab8dcf5550fbbd678 accidentally changed
the return value from kcmio_unix_socket_write to be the result of the
write call.  Most commonly this resulted in it returning 8, which led
to many commands failing with "Exec format error".

(cherry picked from commit 3e76ea104cdaf22c4537833b203f8aeed1691f18)

ticket: 8758
version_fixed: 1.17

src/lib/krb5/ccache/cc_kcm.c

index 2b9f82e3270dd6cfda72aaeec7e07b3c7c25872f..092ab7dafafc206665a67b47bf4ae6fbf9ad3cb7 100644 (file)
@@ -308,8 +308,9 @@ kcmio_unix_socket_write(krb5_context context, struct kcmio *io, void *request,
 
     for (;;) {
         ret = krb5int_net_writev(context, io->fd, sg, 2);
-        if (ret < 0)
-            ret = errno;
+        if (ret >= 0)
+            return 0;
+        ret = errno;
         if (ret != EPIPE || reconnected)
             return ret;
 
@@ -327,8 +328,6 @@ kcmio_unix_socket_write(krb5_context context, struct kcmio *io, void *request,
             return ret;
         reconnected = TRUE;
     }
-
-    return ret;
 }
 
 /* Read a KCM reply: 4-byte big-endian length, 4-byte big-endian status code,