summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libsm/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/libsm/stdio.c')
-rw-r--r--contrib/sendmail/libsm/stdio.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/sendmail/libsm/stdio.c b/contrib/sendmail/libsm/stdio.c
index d45a774..23cc2af 100644
--- a/contrib/sendmail/libsm/stdio.c
+++ b/contrib/sendmail/libsm/stdio.c
@@ -13,7 +13,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: stdio.c,v 1.56.2.10 2003/01/10 23:07:17 ca Exp $")
+SM_RCSID("@(#)$Id: stdio.c,v 1.56.2.13 2003/09/04 01:18:08 ca Exp $")
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -63,7 +63,7 @@ sm_stdopen(fp, info, flags, rpool)
char *path = (char *) info;
int oflags;
- switch (flags)
+ switch (SM_IO_MODE(flags))
{
case SM_IO_RDWR:
oflags = O_RDWR;
@@ -87,6 +87,10 @@ sm_stdopen(fp, info, flags, rpool)
errno = EINVAL;
return -1;
}
+#ifdef O_BINARY
+ if (SM_IS_BINARY(flags))
+ oflags |= O_BINARY;
+#endif /* O_BINARY */
fp->f_file = open(path, oflags,
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
if (fp->f_file < 0)
@@ -221,7 +225,7 @@ sm_stdsetmode(fp, mode)
{
int flags = 0;
- switch (*mode)
+ switch (SM_IO_MODE(*mode))
{
case SM_IO_RDWR:
flags |= SMRW;
@@ -402,7 +406,7 @@ sm_stdfdopen(fp, info, flags, rpool)
{
int oflags, tmp, fdflags, fd = *((int *) info);
- switch (flags)
+ switch (SM_IO_MODE(flags))
{
case SM_IO_RDWR:
oflags = O_RDWR | O_CREAT;
@@ -423,6 +427,10 @@ sm_stdfdopen(fp, info, flags, rpool)
errno = EINVAL;
return -1;
}
+#ifdef O_BINARY
+ if (SM_IS_BINARY(flags))
+ oflags |= O_BINARY;
+#endif /* O_BINARY */
/* Make sure the mode the user wants is a subset of the actual mode. */
if ((fdflags = fcntl(fd, F_GETFL, 0)) < 0)
OpenPOWER on IntegriCloud