core: Minor cleanup in engine-gpg and -gpgsm.
authorWerner Koch <wk@gnupg.org>
Thu, 31 May 2018 21:56:06 +0000 (23:56 +0200)
committerWerner Koch <wk@gnupg.org>
Thu, 31 May 2018 22:13:52 +0000 (00:13 +0200)
* src/engine-gpg.c: Remove errno.h.
(build_argv): Use gpg_error_from_syserror instead of ERRNO.
* src/engine-gpgsm.c: Remove errno.h.
(status_handler): Remove check for EINTR; gpgme_data_write already
handles EINTR.

Signed-off-by: Werner Koch <wk@gnupg.org>
src/engine-gpg.c
src/engine-gpgsm.c

index 173e940..e955820 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#include <errno.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -1039,10 +1038,10 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
            if (_gpgme_io_pipe (fds, fd_data_map[datac].inbound ? 1 : 0)
                == -1)
              {
-               int saved_errno = errno;
+               int saved_err = gpg_error_from_syserror ();
                free (fd_data_map);
                free_argv (argv);
-               return gpg_error (saved_errno);
+               return saved_err;
              }
            if (_gpgme_io_set_close_notify (fds[0],
                                            close_notify_handler, gpg)
index 7b22183..84a9315 100644 (file)
@@ -37,7 +37,6 @@
 #include <locale.h>
 #endif
 #include <fcntl.h> /* FIXME */
-#include <errno.h>
 
 #include "gpgme.h"
 #include "util.h"
@@ -986,8 +985,7 @@ status_handler (void *opaque, int fd)
           while (linelen > 0)
             {
               nwritten = gpgme_data_write (gpgsm->inline_data, src, linelen);
-              if (!nwritten || (nwritten < 0 && errno != EINTR)
-                  || nwritten > linelen)
+              if (nwritten <= 0 || nwritten > linelen)
                 {
                   err = gpg_error_from_syserror ();
                   break;