aboutsummaryrefslogtreecommitdiff
path: root/contrib/sendmail/libsm/stdio.c
diff options
context:
space:
mode:
authorGregory Neil Shapiro <gshapiro@FreeBSD.org>2002-04-10 03:05:00 +0000
committerGregory Neil Shapiro <gshapiro@FreeBSD.org>2002-04-10 03:05:00 +0000
commit605302a5c9939b7eeda0a31f38901d9a8348e8cb (patch)
tree348e6162af337e0b74db963f6e4dcc567e2f99e9 /contrib/sendmail/libsm/stdio.c
parent04bb1e1f1766450d87d6cc51bb4918e8d653211a (diff)
downloadsrc-605302a5c9939b7eeda0a31f38901d9a8348e8cb.tar.gz
src-605302a5c9939b7eeda0a31f38901d9a8348e8cb.zip
Import sendmail 8.12.3
Notes
Notes: svn path=/vendor/sendmail/dist/; revision=94334
Diffstat (limited to 'contrib/sendmail/libsm/stdio.c')
-rw-r--r--contrib/sendmail/libsm/stdio.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/contrib/sendmail/libsm/stdio.c b/contrib/sendmail/libsm/stdio.c
index e688fb96ed9d..c3ab72d0124b 100644
--- a/contrib/sendmail/libsm/stdio.c
+++ b/contrib/sendmail/libsm/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -13,7 +13,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: stdio.c,v 1.52 2001/09/18 21:45:23 gshapiro Exp $")
+SM_RCSID("@(#)$Id: stdio.c,v 1.56 2002/04/03 21:55:15 ca Exp $")
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
@@ -338,24 +338,31 @@ sm_stdgetinfo(fp, what, valp)
case SM_IO_WHAT_FD:
return fp->f_file;
+ case SM_IO_WHAT_SIZE:
+ {
+ struct stat st;
+
+ if (fstat(fp->f_file, &st) == 0)
+ return st.st_size;
+ else
+ return -1;
+ }
+
case SM_IO_IS_READABLE:
- {
- fd_set readfds;
- struct timeval timeout;
-
- FD_ZERO(&readfds);
- SM_FD_SET(fp->f_file, &readfds);
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- if (select(fp->f_file + 1,
- FDSET_CAST &readfds,
- NULL,
- NULL,
- &timeout) > 0 &&
- SM_FD_ISSET(fp->f_file, &readfds))
- return 1;
- return 0;
- }
+ {
+ fd_set readfds;
+ struct timeval timeout;
+
+ FD_ZERO(&readfds);
+ SM_FD_SET(fp->f_file, &readfds);
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ if (select(fp->f_file + 1, FDSET_CAST &readfds,
+ NULL, NULL, &timeout) > 0 &&
+ SM_FD_ISSET(fp->f_file, &readfds))
+ return 1;
+ return 0;
+ }
default:
errno = EINVAL;
@@ -364,19 +371,19 @@ sm_stdgetinfo(fp, what, valp)
}
/*
-** SM_STDFDOPEN -- open file by primative 'fd' rather than pathname
+** SM_STDFDOPEN -- open file by primitive 'fd' rather than pathname
**
** I/O function to handle fdopen() stdio equivalence. The rest of
** the functions are the same as the sm_stdopen() above.
**
** Parameters:
** fp -- the file pointer to be associated with the open
-** name -- the primative file descriptor for association
+** name -- the primitive file descriptor for association
** flags -- indicates type of access methods
** rpool -- ignored
**
** Results:
-** Success: primative file descriptor value
+** Success: primitive file descriptor value
** Failure: -1 and sets errno
*/