mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgconf does now work for Wince.
This commit is contained in:
parent
15330f36a7
commit
d9791119d0
@ -1,3 +1,15 @@
|
|||||||
|
2010-08-23 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* exechelp-w32ce.c: Rewrite all spawn stuff.
|
||||||
|
|
||||||
|
* exechelp-w32.c (close_all_fds) [W32]: Make it a dummy function.
|
||||||
|
|
||||||
|
* estream.c (es_onclose): New.
|
||||||
|
(notify_list_t, onclose): New.
|
||||||
|
(struct estream_internal): Add field ONCLOSE.
|
||||||
|
(es_initialize, es_deinitialize): Manage new field.
|
||||||
|
(do_close): Call onclose notify functions.
|
||||||
|
|
||||||
2010-08-20 Werner Koch <wk@g10code.com>
|
2010-08-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* exechelp-w32.c (create_inheritable_pipe): Change arg to HANDLE.
|
* exechelp-w32.c (create_inheritable_pipe): Change arg to HANDLE.
|
||||||
|
@ -202,8 +202,16 @@ dummy_mutex_call_int (estream_mutex_t mutex)
|
|||||||
|
|
||||||
#define ES_DEFAULT_OPEN_MODE (S_IRUSR | S_IWUSR)
|
#define ES_DEFAULT_OPEN_MODE (S_IRUSR | S_IWUSR)
|
||||||
|
|
||||||
/* An internal stream object. */
|
/* A linked list to hold notification functions. */
|
||||||
|
struct notify_list_s
|
||||||
|
{
|
||||||
|
struct notify_list_s *next;
|
||||||
|
void (*fnc) (estream_t, void*); /* The notification function. */
|
||||||
|
void *fnc_value; /* The value to be passed to FNC. */
|
||||||
|
};
|
||||||
|
typedef struct notify_list_s *notify_list_t;
|
||||||
|
|
||||||
|
/* An internal stream object. */
|
||||||
struct estream_internal
|
struct estream_internal
|
||||||
{
|
{
|
||||||
unsigned char buffer[BUFFER_BLOCK_SIZE];
|
unsigned char buffer[BUFFER_BLOCK_SIZE];
|
||||||
@ -230,6 +238,7 @@ struct estream_internal
|
|||||||
unsigned int stdstream_fd:2; /* 0, 1 or 2 for a standard stream. */
|
unsigned int stdstream_fd:2; /* 0, 1 or 2 for a standard stream. */
|
||||||
unsigned int printable_fname_inuse: 1; /* es_fname_get has been used. */
|
unsigned int printable_fname_inuse: 1; /* es_fname_get has been used. */
|
||||||
size_t print_ntotal; /* Bytes written from in print_writer. */
|
size_t print_ntotal; /* Bytes written from in print_writer. */
|
||||||
|
notify_list_t onclose; /* On close notify function list. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1534,6 +1543,7 @@ es_initialize (estream_t stream,
|
|||||||
stream->intern->deallocate_buffer = 0;
|
stream->intern->deallocate_buffer = 0;
|
||||||
stream->intern->printable_fname = NULL;
|
stream->intern->printable_fname = NULL;
|
||||||
stream->intern->printable_fname_inuse = 0;
|
stream->intern->printable_fname_inuse = 0;
|
||||||
|
stream->intern->onclose = NULL;
|
||||||
|
|
||||||
stream->data_len = 0;
|
stream->data_len = 0;
|
||||||
stream->data_offset = 0;
|
stream->data_offset = 0;
|
||||||
@ -1568,6 +1578,12 @@ es_deinitialize (estream_t stream)
|
|||||||
mem_free (stream->intern->printable_fname);
|
mem_free (stream->intern->printable_fname);
|
||||||
stream->intern->printable_fname = NULL;
|
stream->intern->printable_fname = NULL;
|
||||||
stream->intern->printable_fname_inuse = 0;
|
stream->intern->printable_fname_inuse = 0;
|
||||||
|
while (stream->intern->onclose)
|
||||||
|
{
|
||||||
|
notify_list_t tmp = stream->intern->onclose->next;
|
||||||
|
mem_free (stream->intern->onclose);
|
||||||
|
stream->intern->onclose = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -1637,6 +1653,16 @@ do_close (estream_t stream, int with_locked_list)
|
|||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
es_list_remove (stream, with_locked_list);
|
es_list_remove (stream, with_locked_list);
|
||||||
|
while (stream->intern->onclose)
|
||||||
|
{
|
||||||
|
notify_list_t tmp = stream->intern->onclose->next;
|
||||||
|
|
||||||
|
if (stream->intern->onclose->fnc)
|
||||||
|
stream->intern->onclose->fnc (stream,
|
||||||
|
stream->intern->onclose->fnc_value);
|
||||||
|
mem_free (stream->intern->onclose);
|
||||||
|
stream->intern->onclose = tmp;
|
||||||
|
}
|
||||||
err = es_deinitialize (stream);
|
err = es_deinitialize (stream);
|
||||||
mem_free (stream->intern);
|
mem_free (stream->intern);
|
||||||
mem_free (stream);
|
mem_free (stream);
|
||||||
@ -1647,6 +1673,34 @@ do_close (estream_t stream, int with_locked_list)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This worker function is called with a locked stream. */
|
||||||
|
static int
|
||||||
|
do_onclose (estream_t stream, int mode,
|
||||||
|
void (*fnc) (estream_t, void*), void *fnc_value)
|
||||||
|
{
|
||||||
|
notify_list_t item;
|
||||||
|
|
||||||
|
if (!mode)
|
||||||
|
{
|
||||||
|
for (item = stream->intern->onclose; item; item = item->next)
|
||||||
|
if (item->fnc && item->fnc == fnc && item->fnc_value == fnc_value)
|
||||||
|
item->fnc = NULL; /* Disable this notification. */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = mem_alloc (sizeof *item);
|
||||||
|
if (!item)
|
||||||
|
return -1;
|
||||||
|
item->fnc = fnc;
|
||||||
|
item->fnc_value = fnc_value;
|
||||||
|
item->next = stream->intern->onclose;
|
||||||
|
stream->intern->onclose = item;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Try to read BYTES_TO_READ bytes FROM STREAM into BUFFER in
|
/* Try to read BYTES_TO_READ bytes FROM STREAM into BUFFER in
|
||||||
unbuffered-mode, storing the amount of bytes read in
|
unbuffered-mode, storing the amount of bytes read in
|
||||||
*BYTES_READ. */
|
*BYTES_READ. */
|
||||||
@ -2760,6 +2814,7 @@ es_sysopen_nc (es_syshd_t *syshd, const char *mode)
|
|||||||
void
|
void
|
||||||
_es_set_std_fd (int no, int fd)
|
_es_set_std_fd (int no, int fd)
|
||||||
{
|
{
|
||||||
|
fprintf (stderr, "es_set_std_fd(%d, %d)\n", no, fd);
|
||||||
ESTREAM_LIST_LOCK;
|
ESTREAM_LIST_LOCK;
|
||||||
if (no >= 0 && no < 3 && !custom_std_fds_valid[no])
|
if (no >= 0 && no < 3 && !custom_std_fds_valid[no])
|
||||||
{
|
{
|
||||||
@ -2908,6 +2963,34 @@ es_fclose (estream_t stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Register or unregister a close notification function for STREAM.
|
||||||
|
FNC is the function to call and FNC_VALUE the value passed as
|
||||||
|
second argument. To register the notification the value for MODE
|
||||||
|
must be 1. If mode is 0 the function tries to remove or disable an
|
||||||
|
already registered notification; for this to work the value of FNC
|
||||||
|
and FNC_VALUE must be the same as with the registration and
|
||||||
|
FNC_VALUE must be a unique value. No error will be returned if
|
||||||
|
MODE is 0. Unregistered should only be used in the error case
|
||||||
|
because it may not remove memory internall allocated for the
|
||||||
|
onclose handler.
|
||||||
|
|
||||||
|
The notification will be called right before the stream is closed.
|
||||||
|
It may not call any estream function for STREAM, neither direct nor
|
||||||
|
indirectly. */
|
||||||
|
int
|
||||||
|
es_onclose (estream_t stream, int mode,
|
||||||
|
void (*fnc) (estream_t, void*), void *fnc_value)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
ESTREAM_LOCK (stream);
|
||||||
|
err = do_onclose (stream, mode, fnc, fnc_value);
|
||||||
|
ESTREAM_UNLOCK (stream);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
es_fileno_unlocked (estream_t stream)
|
es_fileno_unlocked (estream_t stream)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,7 @@
|
|||||||
#define es_freopen _ESTREAM_PREFIX(es_freopen)
|
#define es_freopen _ESTREAM_PREFIX(es_freopen)
|
||||||
#define es_fopencookie _ESTREAM_PREFIX(es_fopencookie)
|
#define es_fopencookie _ESTREAM_PREFIX(es_fopencookie)
|
||||||
#define es_fclose _ESTREAM_PREFIX(es_fclose)
|
#define es_fclose _ESTREAM_PREFIX(es_fclose)
|
||||||
|
#define es_onclose _ESTREAM_PREFIX(es_onclose)
|
||||||
#define es_fileno _ESTREAM_PREFIX(es_fileno)
|
#define es_fileno _ESTREAM_PREFIX(es_fileno)
|
||||||
#define es_fileno_unlocked _ESTREAM_PREFIX(es_fileno_unlocked)
|
#define es_fileno_unlocked _ESTREAM_PREFIX(es_fileno_unlocked)
|
||||||
#define es_flockfile _ESTREAM_PREFIX(es_flockfile)
|
#define es_flockfile _ESTREAM_PREFIX(es_flockfile)
|
||||||
@ -281,6 +282,8 @@ estream_t es_fopencookie (void *ES__RESTRICT cookie,
|
|||||||
const char *ES__RESTRICT mode,
|
const char *ES__RESTRICT mode,
|
||||||
es_cookie_io_functions_t functions);
|
es_cookie_io_functions_t functions);
|
||||||
int es_fclose (estream_t stream);
|
int es_fclose (estream_t stream);
|
||||||
|
int es_onclose (estream_t stream, int mode,
|
||||||
|
void (*fnc) (estream_t, void*), void *fnc_value);
|
||||||
int es_fileno (estream_t stream);
|
int es_fileno (estream_t stream);
|
||||||
int es_fileno_unlocked (estream_t stream);
|
int es_fileno_unlocked (estream_t stream);
|
||||||
int es_syshd (estream_t stream, es_syshd_t *syshd);
|
int es_syshd (estream_t stream, es_syshd_t *syshd);
|
||||||
|
@ -94,43 +94,12 @@ get_max_fds (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Close all file descriptors starting with descriptor FIRST. If
|
/* Under Windows this is a dummy function. */
|
||||||
EXCEPT is not NULL, it is expected to be a list of file descriptors
|
|
||||||
which shall not be closed. This list shall be sorted in ascending
|
|
||||||
order with the end marked by -1. */
|
|
||||||
void
|
void
|
||||||
close_all_fds (int first, int *except)
|
close_all_fds (int first, int *except)
|
||||||
{
|
{
|
||||||
int max_fd = get_max_fds ();
|
(void)first;
|
||||||
int fd, i, except_start;
|
(void)except;
|
||||||
|
|
||||||
if (except)
|
|
||||||
{
|
|
||||||
except_start = 0;
|
|
||||||
for (fd=first; fd < max_fd; fd++)
|
|
||||||
{
|
|
||||||
for (i=except_start; except[i] != -1; i++)
|
|
||||||
{
|
|
||||||
if (except[i] == fd)
|
|
||||||
{
|
|
||||||
/* If we found the descriptor in the exception list
|
|
||||||
we can start the next compare run at the next
|
|
||||||
index because the exception list is ordered. */
|
|
||||||
except_start = i + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (except[i] == -1)
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (fd=first; fd < max_fd; fd++)
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
gpg_err_set_errno (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@
|
|||||||
struct feeder_thread_parms
|
struct feeder_thread_parms
|
||||||
{
|
{
|
||||||
estream_t stream;
|
estream_t stream;
|
||||||
int fd;
|
volatile int stream_valid;
|
||||||
|
HANDLE hd;
|
||||||
int direction;
|
int direction;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,71 +90,106 @@ feeder_thread (void *arg)
|
|||||||
{
|
{
|
||||||
struct feeder_thread_parms *parm = arg;
|
struct feeder_thread_parms *parm = arg;
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (parm->direction)
|
if (parm->direction)
|
||||||
{
|
{
|
||||||
size_t nread;
|
size_t nread = 0;
|
||||||
DWORD nwritten;
|
DWORD nwritten;
|
||||||
|
|
||||||
while (!es_read (parm->stream, buffer, sizeof buffer, &nread))
|
log_debug ("feeder_thread estream->pipe: stream=%p pipe=%p\n",
|
||||||
|
parm->stream, parm->hd);
|
||||||
|
while (parm->stream_valid
|
||||||
|
&& !es_read (parm->stream, buffer, sizeof buffer, &nread))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!WriteFile (fd_to_handle (parm->fd),
|
pth_enter ();
|
||||||
buffer, nread, &nwritten, NULL))
|
rc = WriteFile (parm->hd, buffer, nread, &nwritten, NULL);
|
||||||
|
pth_leave ();
|
||||||
|
if (!rc)
|
||||||
{
|
{
|
||||||
log_debug ("feeder(%d): WriteFile error: rc=%d\n",
|
log_debug ("feeder(%p): WriteFile error: rc=%d\n",
|
||||||
parm->fd, (int)GetLastError ());
|
parm->hd, (int)GetLastError ());
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
nread -= nwritten;
|
nread -= nwritten;
|
||||||
}
|
}
|
||||||
while (nread);
|
while (nread);
|
||||||
}
|
}
|
||||||
if (nread)
|
if (!parm->stream_valid)
|
||||||
log_debug ("feeder(%d): es_read error: %s\n",
|
log_debug ("feeder(%p): closed by other thread\n", parm->hd);
|
||||||
parm->fd, strerror (errno));
|
else if (nread)
|
||||||
|
log_debug ("feeder(%p): es_read error: %s\n",
|
||||||
|
parm->hd, strerror (errno));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DWORD nread;
|
DWORD nread = 0;
|
||||||
size_t nwritten;
|
size_t nwritten;
|
||||||
|
|
||||||
while (ReadFile (fd_to_handle (parm->fd),
|
log_debug ("feeder_thread pipe->estream: stream=%p pipe=%p\n",
|
||||||
buffer, sizeof buffer, &nread, NULL) && nread)
|
parm->stream, parm->hd);
|
||||||
|
while ( (pth_enter (),
|
||||||
|
(rc = ReadFile (parm->hd, buffer, sizeof buffer, &nread, NULL)),
|
||||||
|
pth_leave (),
|
||||||
|
rc) && nread)
|
||||||
{
|
{
|
||||||
do
|
log_debug ("feeder_thread pipe->estream: read %d bytes\n",
|
||||||
|
(int)nread);
|
||||||
|
do
|
||||||
{
|
{
|
||||||
if (es_write (parm->stream, buffer, nread, &nwritten))
|
if (parm->stream_valid
|
||||||
|
&& es_write (parm->stream, buffer, nread, &nwritten))
|
||||||
{
|
{
|
||||||
log_debug ("feeder(%d): es_write error: %s\n",
|
log_debug ("feeder(%p): es_write error: %s\n",
|
||||||
parm->fd, strerror (errno));
|
parm->hd, strerror (errno));
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
log_debug ("feeder_thread pipe->estream: es_wrote %d bytes\n",
|
||||||
|
(int)nwritten);
|
||||||
nread -= nwritten;
|
nread -= nwritten;
|
||||||
}
|
}
|
||||||
while (nread);
|
while (nread && parm->stream_valid);
|
||||||
}
|
}
|
||||||
if (nread)
|
if (!parm->stream_valid)
|
||||||
log_debug ("feeder(%d): ReadFile error: rc=%d\n",
|
log_debug ("feeder(%p): closed by other thread\n", parm->hd);
|
||||||
parm->fd, (int)GetLastError ());
|
else if (nread)
|
||||||
|
log_debug ("feeder(%p): ReadFile error: rc=%d\n",
|
||||||
|
parm->hd, (int)GetLastError ());
|
||||||
else
|
else
|
||||||
log_debug ("feeder(%d): eof\n", parm->fd);
|
log_debug ("feeder(%p): eof\n", parm->hd);
|
||||||
}
|
}
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
CloseHandle (fd_to_handle (parm->fd));
|
log_debug ("feeder(%p): waiting for es_fclose\n", parm->hd);
|
||||||
|
while (parm->stream_valid)
|
||||||
|
pth_yield (NULL);
|
||||||
|
log_debug ("feeder(%p): about to close the pipe handle\n", parm->hd);
|
||||||
|
CloseHandle (parm->hd);
|
||||||
|
log_debug ("feeder(%p): pipe handle closed\n", parm->hd);
|
||||||
xfree (parm);
|
xfree (parm);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /*USE_GNU_PTH*/
|
#endif /*USE_GNU_PTH*/
|
||||||
|
|
||||||
|
#ifdef USE_GNU_PTH
|
||||||
|
static void
|
||||||
|
feeder_onclose_notification (estream_t stream, void *opaque)
|
||||||
|
{
|
||||||
|
struct feeder_thread_parms *parm = opaque;
|
||||||
|
(void)stream;
|
||||||
|
log_debug ("feeder(%p): received onclose note\n", parm->hd);
|
||||||
|
parm->stream_valid = 0;
|
||||||
|
}
|
||||||
|
#endif /*USE_GNU_PTH*/
|
||||||
|
|
||||||
/* Fire up a thread to copy data between STREAM and a pipe's
|
/* Fire up a thread to copy data between STREAM and a pipe's
|
||||||
descriptor FD. With DIRECTION set to true the copy takes place
|
descriptor FD. With DIRECTION set to true the copy takes place
|
||||||
from the stream to the pipe, otherwise from the pipe to the
|
from the stream to the pipe, otherwise from the pipe to the
|
||||||
stream. */
|
stream. */
|
||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
start_feeder (estream_t stream, int fd, int direction)
|
start_feeder (estream_t stream, HANDLE hd, int direction)
|
||||||
{
|
{
|
||||||
#ifdef USE_GNU_PTH
|
#ifdef USE_GNU_PTH
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
@ -164,19 +200,27 @@ start_feeder (estream_t stream, int fd, int direction)
|
|||||||
if (!parm)
|
if (!parm)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
parm->stream = stream;
|
parm->stream = stream;
|
||||||
parm->fd = fd;
|
parm->stream_valid = 1;
|
||||||
|
parm->hd = hd;
|
||||||
parm->direction = direction;
|
parm->direction = direction;
|
||||||
|
|
||||||
|
if (es_onclose (stream, 1, feeder_onclose_notification, parm))
|
||||||
|
{
|
||||||
|
err = gpg_error_from_syserror ();
|
||||||
|
xfree (parm);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
tattr = pth_attr_new ();
|
tattr = pth_attr_new ();
|
||||||
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
|
||||||
pth_attr_set (tattr, PTH_ATTR_STACK_SIZE, 64*1024);
|
pth_attr_set (tattr, PTH_ATTR_STACK_SIZE, 64*1024);
|
||||||
pth_attr_set (tattr, PTH_ATTR_NAME, "exec-feeder");
|
pth_attr_set (tattr, PTH_ATTR_NAME, "exec-feeder");
|
||||||
|
|
||||||
log_error ("spawning new feeder(%p, %d, %d)\n", stream, fd, direction);
|
log_debug ("spawning new feeder(%p, %p, %d)\n", stream, hd, direction);
|
||||||
if(!pth_spawn (tattr, feeder_thread, parm))
|
if(!pth_spawn (tattr, feeder_thread, parm))
|
||||||
{
|
{
|
||||||
err = gpg_error_from_syserror ();
|
err = gpg_error_from_syserror ();
|
||||||
log_error ("error spawning feeder: %s\n", gpg_strerror (err));
|
es_onclose (stream, 0, feeder_onclose_notification, parm);
|
||||||
xfree (parm);
|
xfree (parm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -186,7 +230,7 @@ start_feeder (estream_t stream, int fd, int direction)
|
|||||||
return err;
|
return err;
|
||||||
#else
|
#else
|
||||||
(void)stream;
|
(void)stream;
|
||||||
(void)fd;
|
(void)hd;
|
||||||
(void)direction;
|
(void)direction;
|
||||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED); /* No Pth. */
|
return gpg_error (GPG_ERR_NOT_IMPLEMENTED); /* No Pth. */
|
||||||
#endif
|
#endif
|
||||||
@ -214,50 +258,19 @@ get_max_fds (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Close all file descriptors starting with descriptor FIRST. If
|
/* Under Windows this is a dummy function. */
|
||||||
EXCEPT is not NULL, it is expected to be a list of file descriptors
|
|
||||||
which shall not be closed. This list shall be sorted in ascending
|
|
||||||
order with the end marked by -1. */
|
|
||||||
void
|
void
|
||||||
close_all_fds (int first, int *except)
|
close_all_fds (int first, int *except)
|
||||||
{
|
{
|
||||||
int max_fd = get_max_fds ();
|
(void)first;
|
||||||
int fd, i, except_start;
|
(void)except;
|
||||||
|
|
||||||
if (except)
|
|
||||||
{
|
|
||||||
except_start = 0;
|
|
||||||
for (fd=first; fd < max_fd; fd++)
|
|
||||||
{
|
|
||||||
for (i=except_start; except[i] != -1; i++)
|
|
||||||
{
|
|
||||||
if (except[i] == fd)
|
|
||||||
{
|
|
||||||
/* If we found the descriptor in the exception list
|
|
||||||
we can start the next compare run at the next
|
|
||||||
index because the exception list is ordered. */
|
|
||||||
except_start = i + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (except[i] == -1)
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (fd=first; fd < max_fd; fd++)
|
|
||||||
close (fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
gpg_err_set_errno (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns an array with all currently open file descriptors. The end
|
/* Returns an array with all currently open file descriptors. The end
|
||||||
of the array is marked by -1. The caller needs to release this
|
of the array is marked by -1. The caller needs to release this
|
||||||
array using the *standard free* and not with xfree. This allow the
|
array using the *standard free* and not with xfree. This allow the
|
||||||
use of this fucntion right at startup even before libgcrypt has
|
use of this function right at startup even before libgcrypt has
|
||||||
been initialized. Returns NULL on error and sets ERRNO
|
been initialized. Returns NULL on error and sets ERRNO
|
||||||
accordingly. */
|
accordingly. */
|
||||||
int *
|
int *
|
||||||
@ -335,9 +348,7 @@ copy_quoted (char *p, const char *string)
|
|||||||
CMDLINE gets the address of a newly allocated string. */
|
CMDLINE gets the address of a newly allocated string. */
|
||||||
static int
|
static int
|
||||||
build_w32_commandline (const char * const *argv,
|
build_w32_commandline (const char * const *argv,
|
||||||
int fd0, int fd0_isnull,
|
int rvid0, int rvid1, int rvid2,
|
||||||
int fd1, int fd1_isnull,
|
|
||||||
int fd2, int fd2_isnull,
|
|
||||||
char **cmdline)
|
char **cmdline)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
@ -347,30 +358,24 @@ build_w32_commandline (const char * const *argv,
|
|||||||
|
|
||||||
p = fdbuf;
|
p = fdbuf;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if (fd0)
|
|
||||||
{
|
if (rvid0)
|
||||||
if (fd0_isnull)
|
snprintf (p, 25, "-&S0=%d ", rvid0);
|
||||||
strcpy (p, "-&S0=null ");
|
else
|
||||||
else
|
strcpy (p, "-&S0=null ");
|
||||||
snprintf (p, 25, "-&S0=%d ", fd0);
|
p += strlen (p);
|
||||||
p += strlen (p);
|
|
||||||
}
|
if (rvid1)
|
||||||
if (fd1)
|
snprintf (p, 25, "-&S1=%d ", rvid1);
|
||||||
{
|
else
|
||||||
if (fd1_isnull)
|
strcpy (p, "-&S1=null ");
|
||||||
strcpy (p, "-&S1=null ");
|
p += strlen (p);
|
||||||
else
|
|
||||||
snprintf (p, 25, "-&S1=%d ", fd1);
|
if (rvid2)
|
||||||
p += strlen (p);
|
snprintf (p, 25, "-&S2=%d ", rvid2);
|
||||||
}
|
else
|
||||||
if (fd2)
|
strcpy (p, "-&S2=null ");
|
||||||
{
|
p += strlen (p);
|
||||||
if (fd2_isnull)
|
|
||||||
strcpy (p, "-&S2=null ");
|
|
||||||
else
|
|
||||||
snprintf (p, 25, "-&S2=%d ", fd2);
|
|
||||||
p += strlen (p);
|
|
||||||
}
|
|
||||||
|
|
||||||
*cmdline = NULL;
|
*cmdline = NULL;
|
||||||
n = strlen (fdbuf);
|
n = strlen (fdbuf);
|
||||||
@ -492,94 +497,149 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
|||||||
estream_t *r_errfp,
|
estream_t *r_errfp,
|
||||||
pid_t *pid)
|
pid_t *pid)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
PROCESS_INFORMATION pi = {NULL };
|
PROCESS_INFORMATION pi = {NULL };
|
||||||
char *cmdline;
|
char *cmdline;
|
||||||
int inpipe[2], outpipe[2], errpipe[2];
|
es_syshd_t syshd;
|
||||||
|
struct {
|
||||||
|
HANDLE hd;
|
||||||
|
int rvid;
|
||||||
|
} inpipe = {INVALID_HANDLE_VALUE, 0};
|
||||||
|
struct {
|
||||||
|
HANDLE hd;
|
||||||
|
int rvid;
|
||||||
|
} outpipe = {INVALID_HANDLE_VALUE, 0};
|
||||||
|
struct {
|
||||||
|
HANDLE hd;
|
||||||
|
int rvid;
|
||||||
|
} errpipe = {INVALID_HANDLE_VALUE, 0};
|
||||||
|
estream_t outfp = NULL;
|
||||||
|
estream_t errfp = NULL;
|
||||||
|
|
||||||
(void)preexec;
|
(void)preexec;
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
/* Setup return values. */
|
/* Setup return values. */
|
||||||
*statusfile = NULL;
|
if (r_outfp)
|
||||||
*pid = (pid_t)(-1);
|
*r_outfp = NULL;
|
||||||
|
if (r_errfp)
|
||||||
|
*r_errfp = NULL;
|
||||||
|
*pid = (pid_t)(-1); /* Always required. */
|
||||||
|
|
||||||
/* A NULL INFILE or OUTFILE is only used by gpgtar thus we don't
|
log_debug ("%s: enter\n", __func__);
|
||||||
need to implement this for CE. */
|
if (infp)
|
||||||
if (!infile || !outfile)
|
|
||||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
|
||||||
|
|
||||||
es_fflush (infile);
|
|
||||||
es_rewind (infile);
|
|
||||||
|
|
||||||
/* Create a pipe to copy our infile to the stdin of the child
|
|
||||||
process. On success inpipe[1] is owned by the feeder. */
|
|
||||||
err = create_inheritable_pipe (inpipe, 0);
|
|
||||||
if (err)
|
|
||||||
{
|
{
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
es_fflush (infp);
|
||||||
return err;
|
es_rewind (infp);
|
||||||
}
|
|
||||||
err = start_feeder (infile, inpipe[1], 1);
|
/* Create a pipe to copy our infile to the stdin of the child
|
||||||
if (err)
|
process. On success inpipe.hd is owned by the feeder. */
|
||||||
{
|
inpipe.hd = _assuan_w32ce_prepare_pipe (&inpipe.rvid, 1);
|
||||||
log_error (_("error spawning feeder: %s\n"), gpg_strerror (err));
|
if (inpipe.hd == INVALID_HANDLE_VALUE)
|
||||||
CloseHandle (fd_to_handle (inpipe[1]));
|
{
|
||||||
return err;
|
log_error ("_assuan_w32ce_prepare_pipe failed: %s\n",
|
||||||
|
w32_strerror (-1));
|
||||||
|
gpg_err_set_errno (EIO);
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
|
log_debug ("%s: inpipe %p created; hd=%p rvid=%d\n", __func__,
|
||||||
|
infp, inpipe.hd, inpipe.rvid);
|
||||||
|
err = start_feeder (infp, inpipe.hd, 1);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
log_error ("error spawning feeder: %s\n", gpg_strerror (err));
|
||||||
|
CloseHandle (inpipe.hd);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
inpipe.hd = INVALID_HANDLE_VALUE; /* Now owned by the feeder. */
|
||||||
|
log_debug ("%s: inpipe %p created; feeder started\n", __func__,
|
||||||
|
infp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a pipe to copy stdout of the child process to our
|
if (r_outfp)
|
||||||
outfile. On success outpipe[0] is owned by the feeded. */
|
|
||||||
err = create_inheritable_pipe (outpipe, 1);
|
|
||||||
if (err)
|
|
||||||
{
|
{
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
/* Create a pipe to make the stdout of the child process
|
||||||
return err;
|
available as a stream. */
|
||||||
|
outpipe.hd = _assuan_w32ce_prepare_pipe (&outpipe.rvid, 0);
|
||||||
|
if (outpipe.hd == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
log_error ("_assuan_w32ce_prepare_pipe failed: %s\n",
|
||||||
|
w32_strerror (-1));
|
||||||
|
gpg_err_set_errno (EIO);
|
||||||
|
/* Fixme release other stuff/kill feeder. */
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
|
syshd.type = ES_SYSHD_HANDLE;
|
||||||
|
syshd.u.handle = outpipe.hd;
|
||||||
|
err = 0;
|
||||||
|
outfp = es_sysopen (&syshd, "r");
|
||||||
|
if (!outfp)
|
||||||
|
{
|
||||||
|
err = gpg_err_make (errsource, gpg_err_code_from_syserror ());
|
||||||
|
log_error ("error opening pipe stream: %s\n", gpg_strerror (err));
|
||||||
|
CloseHandle (outpipe.hd);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
log_debug ("%s: outpipe %p created; hd=%p rvid=%d\n", __func__,
|
||||||
|
outfp, outpipe.hd, outpipe.rvid);
|
||||||
|
outpipe.hd = INVALID_HANDLE_VALUE; /* Now owned by the OUTFP. */
|
||||||
}
|
}
|
||||||
err = start_feeder (outfile, outpipe[0], 0);
|
|
||||||
if (err)
|
if (r_errfp)
|
||||||
{
|
{
|
||||||
log_error (_("error spawning feeder: %s\n"), gpg_strerror (err));
|
/* Create a pipe to make the stderr of the child process
|
||||||
CloseHandle (fd_to_handle (outpipe[0]));
|
available as a stream. */
|
||||||
return err;
|
errpipe.hd = _assuan_w32ce_prepare_pipe (&errpipe.rvid, 0);
|
||||||
|
if (errpipe.hd == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
log_error ("_assuan_w32ce_prepare_pipe failed: %s\n",
|
||||||
|
w32_strerror (-1));
|
||||||
|
gpg_err_set_errno (EIO);
|
||||||
|
/* Fixme release other stuff/kill feeder. */
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
|
syshd.type = ES_SYSHD_HANDLE;
|
||||||
|
syshd.u.handle = errpipe.hd;
|
||||||
|
err = 0;
|
||||||
|
errfp = es_sysopen (&syshd, "r");
|
||||||
|
if (!errfp)
|
||||||
|
{
|
||||||
|
err = gpg_err_make (errsource, gpg_err_code_from_syserror ());
|
||||||
|
log_error ("error opening pipe stream: %s\n", gpg_strerror (err));
|
||||||
|
CloseHandle (errpipe.hd);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
log_debug ("%s: errpipe %p created; hd=%p rvid=%d\n", __func__,
|
||||||
|
errfp, errpipe.hd, errpipe.rvid);
|
||||||
|
errpipe.hd = INVALID_HANDLE_VALUE; /* Now owned by the ERRFP. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create a pipe for use with stderr of the child process. */
|
|
||||||
err = create_inheritable_pipe (errpipe, 1);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
log_error (_("error creating a pipe: %s\n"), gpg_strerror (err));
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Build the command line. */
|
/* Build the command line. */
|
||||||
err = build_w32_commandline (argv,
|
err = build_w32_commandline (argv, inpipe.rvid, outpipe.rvid, errpipe.rvid,
|
||||||
inpipe[0], 0,
|
|
||||||
outpipe[1], 0,
|
|
||||||
errpipe[1], 0,
|
|
||||||
&cmdline);
|
&cmdline);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
CloseHandle (fd_to_handle (errpipe[0]));
|
/* Fixme release other stuff/kill feeder. */
|
||||||
|
CloseHandle (errpipe.hd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline);
|
log_debug ("CreateProcess, path=`%s' cmdline=`%s'\n", pgmname, cmdline);
|
||||||
if (!create_process (pgmname, cmdline, &pi))
|
if (!create_process (pgmname, cmdline, &pi))
|
||||||
{
|
{
|
||||||
log_error ("CreateProcess failed: %s\n", w32_strerror (-1));
|
log_error ("CreateProcess failed: %s\n", w32_strerror (-1));
|
||||||
xfree (cmdline);
|
xfree (cmdline);
|
||||||
CloseHandle (fd_to_handle (errpipe[0]));
|
/* Fixme release other stuff/kill feeder. */
|
||||||
|
CloseHandle (errpipe.hd);
|
||||||
return gpg_error (GPG_ERR_GENERAL);
|
return gpg_error (GPG_ERR_GENERAL);
|
||||||
}
|
}
|
||||||
xfree (cmdline);
|
xfree (cmdline);
|
||||||
cmdline = NULL;
|
cmdline = NULL;
|
||||||
|
|
||||||
/* Note: The other end of the pipe is a rendezvous id and thus there
|
/* Note: The other end of the pipe is a rendezvous id and thus there
|
||||||
is no need to close. */
|
is no need for a close. */
|
||||||
|
|
||||||
log_debug ("CreateProcess ready: hProcess=%p hThread=%p"
|
log_debug ("CreateProcess ready: hProcess=%p hThread=%p"
|
||||||
" dwProcessID=%d dwThreadId=%d\n",
|
" dwProcessID=%d dwThreadId=%d\n",
|
||||||
@ -591,20 +651,12 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
|||||||
ResumeThread (pi.hThread);
|
ResumeThread (pi.hThread);
|
||||||
CloseHandle (pi.hThread);
|
CloseHandle (pi.hThread);
|
||||||
|
|
||||||
*statusfile = es_fdopen (handle_to_fd (errpipe[0]), "r");
|
if (r_outfp)
|
||||||
if (!*statusfile)
|
*r_outfp = outfp;
|
||||||
{
|
if (r_errfp)
|
||||||
err = gpg_error_from_syserror ();
|
*r_errfp = errfp;
|
||||||
log_error (_("can't fdopen pipe for reading: %s\n"), gpg_strerror (err));
|
|
||||||
CloseHandle (pi.hProcess);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
*pid = handle_to_pid (pi.hProcess);
|
*pid = handle_to_pid (pi.hProcess);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -632,7 +684,7 @@ gnupg_spawn_process_fd (const char *pgmname, const char *argv[],
|
|||||||
return gpg_error (GPG_ERR_NOT_SUPPORTED);
|
return gpg_error (GPG_ERR_NOT_SUPPORTED);
|
||||||
|
|
||||||
/* Build the command line. */
|
/* Build the command line. */
|
||||||
err = build_w32_commandline (argv, -1, 1, -1, 1, -1, 1, &cmdline);
|
err = build_w32_commandline (argv, 0, 0, 0, &cmdline);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -755,7 +807,7 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
|
|||||||
(void)envp;
|
(void)envp;
|
||||||
|
|
||||||
/* Build the command line. */
|
/* Build the command line. */
|
||||||
err = build_w32_commandline (argv, -1, 1, -1, 1, -1, 1, &cmdline);
|
err = build_w32_commandline (argv, 0, 0, 0, &cmdline);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -118,9 +118,18 @@ init_common_subsystems (int *argcp, char ***argvp)
|
|||||||
(void)argvp;
|
(void)argvp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Access the standard estreams as early as possible. If we don't
|
||||||
|
do this the original stdio streams may have been closed when
|
||||||
|
_es_get_std_stream is first use and in turn it would connect to
|
||||||
|
the bit bucket. */
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i < 3; i++)
|
||||||
|
(void)_es_get_std_stream (i);
|
||||||
|
}
|
||||||
|
|
||||||
/* --version et al shall use estream as well. */
|
/* --version et al shall use estream as well. */
|
||||||
argparse_register_outfnc (writestring_via_estream);
|
argparse_register_outfnc (writestring_via_estream);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,6 +200,6 @@ parse_std_file_handles (int *argcp, char ***argvp)
|
|||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /*HAVE_W32CE_SYSTEM*/
|
#endif /*HAVE_W32CE_SYSTEM*/
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2010-08-23 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpgconf-comp.c (GPGNAME) [W32CE]: s/gpg2/gpg/.
|
||||||
|
(get_config_filename) [W32CE]: Adjust absolute file name check.
|
||||||
|
|
||||||
|
* gpgconf-comp.c (retrieve_options_from_program)
|
||||||
|
(retrieve_options_from_file, retrieve_options_from_program)
|
||||||
|
(copy_file, gc_process_gpgconf_conf): Do not use es_ferror after a
|
||||||
|
failed es_fclose. Note that the stream is in any case invalid
|
||||||
|
after calling es_fclose and that es_fclose does set ERRNO.
|
||||||
|
|
||||||
|
* Makefile.am (maybe_commonpth_libs): New.
|
||||||
|
(gpgconf_LDADD): Use it.
|
||||||
|
|
||||||
2010-08-20 Werner Koch <wk@g10code.com>
|
2010-08-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpgconf-comp.c (collect_error_output): Remove extra CRs.
|
* gpgconf-comp.c (collect_error_output): Remove extra CRs.
|
||||||
|
@ -67,6 +67,14 @@ endif
|
|||||||
|
|
||||||
common_libs = $(libcommon) ../gl/libgnu.a
|
common_libs = $(libcommon) ../gl/libgnu.a
|
||||||
commonpth_libs = $(libcommonpth) ../gl/libgnu.a
|
commonpth_libs = $(libcommonpth) ../gl/libgnu.a
|
||||||
|
|
||||||
|
# Some modules require PTH under W32CE.
|
||||||
|
if HAVE_W32CE_SYSTEM
|
||||||
|
maybe_commonpth_libs = $(commonpth_libs)
|
||||||
|
else
|
||||||
|
maybe_commonpth_libs = $(common_libs)
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_W32CE_SYSTEM
|
if HAVE_W32CE_SYSTEM
|
||||||
pwquery_libs =
|
pwquery_libs =
|
||||||
else
|
else
|
||||||
@ -85,8 +93,8 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c
|
|||||||
|
|
||||||
# common sucks in gpg-error, will they, nil they (some compilers
|
# common sucks in gpg-error, will they, nil they (some compilers
|
||||||
# do not eliminate the supposed-to-be-unused-inline-functions).
|
# do not eliminate the supposed-to-be-unused-inline-functions).
|
||||||
gpgconf_LDADD = $(common_libs) $(opt_libassuan_libs) \
|
gpgconf_LDADD = $(maybe_commonpth_libs) $(opt_libassuan_libs) \
|
||||||
$(LIBINTL) $(GPG_ERROR_LIBS) $(NETLIBS) \
|
$(LIBINTL) $(GPG_ERROR_LIBS) $(PTH_LIBS) $(NETLIBS) \
|
||||||
$(LIBICONV) $(W32SOCKLIBS)
|
$(LIBICONV) $(W32SOCKLIBS)
|
||||||
|
|
||||||
gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h
|
gpgparsemail_SOURCES = gpgparsemail.c rfc822parse.c rfc822parse.h
|
||||||
|
@ -54,9 +54,8 @@
|
|||||||
|
|
||||||
/* There is a problem with gpg 1.4 under Windows: --gpgconf-list
|
/* There is a problem with gpg 1.4 under Windows: --gpgconf-list
|
||||||
returns a plain filename without escaping. As long as we have not
|
returns a plain filename without escaping. As long as we have not
|
||||||
fixed that we need to use gpg2 - it might actually be better to use
|
fixed that we need to use gpg2. */
|
||||||
gpg2 in any case. */
|
#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM)
|
||||||
#ifdef HAVE_W32_SYSTEM
|
|
||||||
#define GPGNAME "gpg2"
|
#define GPGNAME "gpg2"
|
||||||
#else
|
#else
|
||||||
#define GPGNAME "gpg"
|
#define GPGNAME "gpg"
|
||||||
@ -1799,7 +1798,9 @@ get_config_filename (gc_component_t component, gc_backend_t backend)
|
|||||||
else
|
else
|
||||||
filename = "";
|
filename = "";
|
||||||
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#if HAVE_W32CE_SYSTEM
|
||||||
|
if (!(filename[0] == '/' || filename[0] == '\\'))
|
||||||
|
#elif defined(HAVE_DOSISH_SYSTEM)
|
||||||
if (!(filename[0]
|
if (!(filename[0]
|
||||||
&& filename[1] == ':'
|
&& filename[1] == ':'
|
||||||
&& (filename[2] == '/' || filename[2] == '\\')))
|
&& (filename[2] == '/' || filename[2] == '\\')))
|
||||||
@ -1916,7 +1917,7 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend)
|
|||||||
}
|
}
|
||||||
if (length < 0 || es_ferror (outfp))
|
if (length < 0 || es_ferror (outfp))
|
||||||
gc_error (1, errno, "error reading from %s", pgmname);
|
gc_error (1, errno, "error reading from %s", pgmname);
|
||||||
if (es_fclose (outfp) && es_ferror (outfp))
|
if (es_fclose (outfp))
|
||||||
gc_error (1, errno, "error closing %s", pgmname);
|
gc_error (1, errno, "error closing %s", pgmname);
|
||||||
|
|
||||||
err = gnupg_wait_process (pgmname, pid, 1, &exitcode);
|
err = gnupg_wait_process (pgmname, pid, 1, &exitcode);
|
||||||
@ -2018,7 +2019,7 @@ retrieve_options_from_program (gc_component_t component, gc_backend_t backend)
|
|||||||
|
|
||||||
if (length < 0 || es_ferror (config))
|
if (length < 0 || es_ferror (config))
|
||||||
gc_error (1, errno, "error reading from %s", config_filename);
|
gc_error (1, errno, "error reading from %s", config_filename);
|
||||||
if (es_fclose (config) && es_ferror (config))
|
if (es_fclose (config))
|
||||||
gc_error (1, errno, "error closing %s", config_filename);
|
gc_error (1, errno, "error closing %s", config_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2098,7 +2099,7 @@ retrieve_options_from_file (gc_component_t component, gc_backend_t backend)
|
|||||||
if (config_option->flags & GC_OPT_FLAG_NO_CHANGE)
|
if (config_option->flags & GC_OPT_FLAG_NO_CHANGE)
|
||||||
list_option->flags |= GC_OPT_FLAG_NO_CHANGE;
|
list_option->flags |= GC_OPT_FLAG_NO_CHANGE;
|
||||||
|
|
||||||
if (list_file && fclose (list_file) && ferror (list_file))
|
if (list_file && fclose (list_file))
|
||||||
gc_error (1, errno, "error closing %s", list_filename);
|
gc_error (1, errno, "error closing %s", list_filename);
|
||||||
xfree (line);
|
xfree (line);
|
||||||
}
|
}
|
||||||
@ -2328,9 +2329,9 @@ copy_file (const char *src_name, const char *dst_name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (dst) && ferror (dst))
|
if (fclose (dst))
|
||||||
gc_error (1, errno, "error closing %s", dst_name);
|
gc_error (1, errno, "error closing %s", dst_name);
|
||||||
if (fclose (src) && ferror (src))
|
if (fclose (src))
|
||||||
gc_error (1, errno, "error closing %s", src_name);
|
gc_error (1, errno, "error closing %s", src_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3623,7 +3624,7 @@ gc_process_gpgconf_conf (const char *fname_arg, int update, int defaults,
|
|||||||
gc_error (0, errno, "error reading from `%s'", fname);
|
gc_error (0, errno, "error reading from `%s'", fname);
|
||||||
result = -1;
|
result = -1;
|
||||||
}
|
}
|
||||||
if (fclose (config) && ferror (config))
|
if (fclose (config))
|
||||||
gc_error (0, errno, "error closing `%s'", fname);
|
gc_error (0, errno, "error closing `%s'", fname);
|
||||||
|
|
||||||
xfree (line);
|
xfree (line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user