mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
common: Minor code cleanup for a legacy OS.
* common/iobuf.c (direct_open) [__riscos__]: Simply cpp conditionals.
This commit is contained in:
parent
adad1872b4
commit
35fdfaa0b9
@ -299,7 +299,9 @@ direct_open (const char *fname, const char *mode)
|
|||||||
hfile = CreateFile (fname, da, sm, NULL, cd, FILE_ATTRIBUTE_NORMAL, NULL);
|
hfile = CreateFile (fname, da, sm, NULL, cd, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
#endif
|
#endif
|
||||||
return hfile;
|
return hfile;
|
||||||
|
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
|
|
||||||
int oflag;
|
int oflag;
|
||||||
int cflag = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
int cflag = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||||
|
|
||||||
@ -324,21 +326,18 @@ direct_open (const char *fname, const char *mode)
|
|||||||
if (strchr (mode, 'b'))
|
if (strchr (mode, 'b'))
|
||||||
oflag |= O_BINARY;
|
oflag |= O_BINARY;
|
||||||
#endif
|
#endif
|
||||||
/* No we need to distinguish between POSIX and RISC OS. */
|
|
||||||
#ifndef __riscos__
|
#ifdef __riscos__
|
||||||
return open (fname, oflag, cflag);
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
int rc = stat (fname, &buf);
|
|
||||||
|
|
||||||
/* Don't allow iobufs on directories */
|
/* Don't allow iobufs on directories */
|
||||||
if (!rc && S_ISDIR (buf.st_mode) && !S_ISREG (buf.st_mode))
|
if (!stat (fname, &buf) && S_ISDIR (buf.st_mode) && !S_ISREG (buf.st_mode))
|
||||||
return __set_errno (EISDIR);
|
return __set_errno (EISDIR);
|
||||||
else
|
|
||||||
return open (fname, oflag, cflag);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return open (fname, oflag, cflag);
|
||||||
|
|
||||||
#endif /*!HAVE_W32_SYSTEM*/
|
#endif /*!HAVE_W32_SYSTEM*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user