aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-06-25 18:25:28 +0000
committerWerner Koch <[email protected]>2014-06-30 06:51:26 +0000
commit35fdfaa0b94342c53eb82eea155a37ad4009fa9f (patch)
tree12d61ec83c9835084ccd76ade0bc02c21b8c93bc
parentspeedo: Fix the w32 installer name (diff)
downloadgnupg-35fdfaa0b94342c53eb82eea155a37ad4009fa9f.tar.gz
gnupg-35fdfaa0b94342c53eb82eea155a37ad4009fa9f.zip
common: Minor code cleanup for a legacy OS.
* common/iobuf.c (direct_open) [__riscos__]: Simply cpp conditionals.
Diffstat (limited to '')
-rw-r--r--common/iobuf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/common/iobuf.c b/common/iobuf.c
index d78e5d2e2..d6862105f 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -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*/
}