mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
common: Raise an error correctly in check_special_filename.
* common/sysutils.c (check_special_filename): Use gnupg_parse_fdstr to check an error. -- GnuPG-bug-id: 6551 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
cacb018992
commit
3672c29156
@ -656,8 +656,27 @@ check_special_filename (const char *fname, int for_write, int notranslate)
|
||||
for (i=0; digitp (fname+i); i++ )
|
||||
;
|
||||
if (!fname[i])
|
||||
return notranslate? atoi (fname)
|
||||
/**/ : translate_sys2libc_fd_int (atoi (fname), for_write);
|
||||
{
|
||||
if (notranslate)
|
||||
return atoi (fname);
|
||||
else
|
||||
{
|
||||
es_syshd_t syshd;
|
||||
|
||||
if (gnupg_parse_fdstr (fname, &syshd))
|
||||
return -1;
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (syshd.type == ES_SYSHD_FD)
|
||||
return syshd.u.fd;
|
||||
else
|
||||
return translate_sys2libc_fd ((gnupg_fd_t)syshd.u.handle, for_write);
|
||||
#else
|
||||
(void)for_write;
|
||||
return syshd.u.fd;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user