diff options
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; |