diff options
author | gshapiro <gshapiro@FreeBSD.org> | 2002-04-10 03:05:00 +0000 |
---|---|---|
committer | gshapiro <gshapiro@FreeBSD.org> | 2002-04-10 03:05:00 +0000 |
commit | 9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84 (patch) | |
tree | 348e6162af337e0b74db963f6e4dcc567e2f99e9 /contrib/sendmail/libsm/smstdio.c | |
parent | 1a7e50d796833cbb4346a251bc88555ea2c58e94 (diff) | |
download | FreeBSD-src-9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84.zip FreeBSD-src-9e3bd35cd79720a6547b183a6a6fb97ab1ae7b84.tar.gz |
Import sendmail 8.12.3
Diffstat (limited to 'contrib/sendmail/libsm/smstdio.c')
-rw-r--r-- | contrib/sendmail/libsm/smstdio.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/contrib/sendmail/libsm/smstdio.c b/contrib/sendmail/libsm/smstdio.c index 758c936..879fcd2 100644 --- a/contrib/sendmail/libsm/smstdio.c +++ b/contrib/sendmail/libsm/smstdio.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. * * By using this file, you agree to the terms and conditions set @@ -8,11 +8,12 @@ */ #include <sm/gen.h> -SM_IDSTR(id, "@(#)$Id: smstdio.c,v 1.29 2001/09/11 04:04:49 gshapiro Exp $") +SM_IDSTR(id, "@(#)$Id: smstdio.c,v 1.32 2002/02/23 20:18:36 gshapiro Exp $") #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <errno.h> +#include <sys/stat.h> #include <sm/assert.h> #include <sm/io.h> #include <sm/string.h> @@ -264,6 +265,22 @@ sm_stdiogetinfo(fp, what, valp) { switch (what) { + case SM_IO_WHAT_SIZE: + { + int fd; + struct stat st; + + if (fp->f_cookie == NULL) + setup(fp); + fd = fileno((FILE *) fp->f_cookie); + if (fd < 0) + return -1; + if (fstat(fd, &st) == 0) + return st.st_size; + else + return -1; + } + case SM_IO_WHAT_MODE: default: errno = EINVAL; |