mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
common,gpg,sm,tools: Don't remove translate_sys2libc_fd_int.
* common/sysutils.c (translate_sys2libc_fd_int): Recover. (translate_sys2libc_fdstr): Remove. (check_special_filename): Follow the change. * common/sysutils.h (translate_sys2libc_fd_int): Recover. (translate_sys2libc_fdstr): Remove. * g10/gpg.c, g10/gpgv.c, sm/gpgsm.c: Revert the changes. * tools/gpg-auth.c, tools/gpg-card.c, tools/gpg-pair-tool.c: Likewise. * tools/gpg-wks-client.c, tools/gpgconf.c: Likewise. -- GnuPG-bug-id: 6551 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
72ac77c4fa
commit
b9b0c18320
10 changed files with 52 additions and 58 deletions
|
@ -556,6 +556,24 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* This is the same as translate_sys2libc_fd but takes an integer
|
||||
which is assumed to be such an system handle. On WindowsCE the
|
||||
passed FD is a rendezvous ID and the function finishes the pipe
|
||||
creation. */
|
||||
int
|
||||
translate_sys2libc_fd_int (int fd, int for_write)
|
||||
{
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (fd <= 2)
|
||||
return fd; /* Do not do this for error, stdin, stdout, stderr. */
|
||||
|
||||
return translate_sys2libc_fd ((void*)fd, for_write);
|
||||
#else
|
||||
(void)for_write;
|
||||
return fd;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse the string representation of a file reference (file handle on
|
||||
|
@ -636,30 +654,6 @@ gnupg_sys2libc_fdstr (const char *fdstr, int for_write,
|
|||
#endif
|
||||
}
|
||||
|
||||
/* This is the same as translate_sys2libc_fd but takes a string
|
||||
which represents a system handle on Windows a file descriptor
|
||||
on POSIX.
|
||||
|
||||
(1) 0, 1, or 2 which means stdin, stdout, and stderr, respectively.
|
||||
(2) Integer representation (by %d of printf).
|
||||
(3) Hex representation which starts as "0x".
|
||||
*/
|
||||
int
|
||||
translate_sys2libc_fdstr (const char *fdstr, int for_write)
|
||||
{
|
||||
gpg_error_t err;
|
||||
int fd;
|
||||
|
||||
err = gnupg_sys2libc_fdstr (fdstr, for_write, NULL, &fd);
|
||||
if (err)
|
||||
{
|
||||
log_error ("FDSTR error: %s\n", fdstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
/* Check whether FNAME has the form "-&nnnn", where N is a non-zero
|
||||
* number. Returns this number or -1 if it is not the case. If the
|
||||
|
@ -679,7 +673,7 @@ check_special_filename (const char *fname, int for_write, int notranslate)
|
|||
;
|
||||
if (!fname[i])
|
||||
return notranslate? atoi (fname)
|
||||
/**/ : translate_sys2libc_fdstr (fname, for_write);
|
||||
/**/ : translate_sys2libc_fd_int (atoi (fname), for_write);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -73,9 +73,9 @@ unsigned int get_uint_nonce (void);
|
|||
void gnupg_sleep (unsigned int seconds);
|
||||
void gnupg_usleep (unsigned int usecs);
|
||||
int translate_sys2libc_fd (gnupg_fd_t fd, int for_write);
|
||||
int translate_sys2libc_fd_int (int fd, int for_write);
|
||||
gpg_error_t gnupg_sys2libc_fdstr (const char *fdstr, int for_write,
|
||||
gnupg_fd_t *r_hd, int *r_fd);
|
||||
int translate_sys2libc_fdstr (const char *fdstr, int for_write);
|
||||
int check_special_filename (const char *fname, int for_write, int notranslate);
|
||||
FILE *gnupg_tmpfile (void);
|
||||
void gnupg_reopen_std (const char *pgmname);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue