mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01: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);
|
||||
#endif
|
||||
return hfile;
|
||||
|
||||
#else /*!HAVE_W32_SYSTEM*/
|
||||
|
||||
int oflag;
|
||||
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'))
|
||||
oflag |= O_BINARY;
|
||||
#endif
|
||||
/* No we need to distinguish between POSIX and RISC OS. */
|
||||
#ifndef __riscos__
|
||||
return open (fname, oflag, cflag);
|
||||
#else
|
||||
|
||||
#ifdef __riscos__
|
||||
{
|
||||
struct stat buf;
|
||||
int rc = stat (fname, &buf);
|
||||
|
||||
/* 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);
|
||||
else
|
||||
return open (fname, oflag, cflag);
|
||||
}
|
||||
#endif
|
||||
return open (fname, oflag, cflag);
|
||||
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user