summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/bf_portable.c
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2001-02-28 00:19:57 +0000
committergshapiro <gshapiro@FreeBSD.org>2001-02-28 00:19:57 +0000
commite4882e48c06ee9963c8275992cd9767a29e01c05 (patch)
tree931d99d3910ebafc6a747029ff208f01292f5d8b /contrib/sendmail/src/bf_portable.c
parent2143eb84286d79cdfaa711372954774a827fee31 (diff)
parent8d82727087db5182be90a20f20175cc720c5d1e5 (diff)
downloadFreeBSD-src-e4882e48c06ee9963c8275992cd9767a29e01c05.zip
FreeBSD-src-e4882e48c06ee9963c8275992cd9767a29e01c05.tar.gz
This commit was generated by cvs2svn to compensate for changes in r73188,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/sendmail/src/bf_portable.c')
-rw-r--r--contrib/sendmail/src/bf_portable.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/contrib/sendmail/src/bf_portable.c b/contrib/sendmail/src/bf_portable.c
index 4de0af3..3c09cec 100644
--- a/contrib/sendmail/src/bf_portable.c
+++ b/contrib/sendmail/src/bf_portable.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.3 2000/06/29 21:21:58 gshapiro Exp $";
+static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.5 2001/02/14 04:07:27 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
@@ -283,6 +283,47 @@ bftruncate(fp)
}
/*
+** BFFSYNC -- fsync the fd associated with the FILE *
+**
+** Parameters:
+** fp -- FILE * to fsync
+**
+** Returns:
+** 0 on success, -1 on error
+**
+** Sets errno:
+** EINVAL if FILE * not bfcommitted yet.
+** any value of errno specified by fsync()
+*/
+
+int
+bffsync(fp)
+ FILE *fp;
+{
+ int fd;
+ struct bf *bfp;
+
+ /* Get associated bf structure */
+ bfp = bflookup(fp);
+
+ /* If called on a normal FILE *, noop */
+ if (bfp != NULL && !bfp->bf_committed)
+ fd = -1;
+ else
+ fd = fileno(fp);
+
+ if (tTd(58, 10))
+ dprintf("bffsync: fd = %d\n", fd);
+
+ if (fd < 0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ return fsync(fd);
+}
+
+ /*
** BFCLOSE -- close a buffered file
**
** Parameters:
OpenPOWER on IntegriCloud