All of lore.kernel.org
 help / color / mirror / Atom feed
From: meyering@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: device-mapper ./WHATS_NEW lib/.exported_symbol ...
Date: 24 Jul 2007 14:15:46 -0000	[thread overview]
Message-ID: <20070724141546.18751.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	meyering@sourceware.org	2007-07-24 14:15:45

Modified files:
	.              : WHATS_NEW 
	lib            : .exported_symbols libdevmapper.h libdm-file.c 

Log message:
	dm_fclose: new function
	* lib/libdevmapper.h: Declare it.
	* lib/libdm-file.c (dm_fclose): Define it.
	* lib/.exported_symbols: Add dm_fclose.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/WHATS_NEW.diff?cvsroot=dm&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/.exported_symbols.diff?cvsroot=dm&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdevmapper.h.diff?cvsroot=dm&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-file.c.diff?cvsroot=dm&r1=1.4&r2=1.5

--- device-mapper/WHATS_NEW	2007/07/13 16:10:24	1.191
+++ device-mapper/WHATS_NEW	2007/07/24 14:15:45	1.192
@@ -1,5 +1,6 @@
 Version 1.02.22 - 
 ================================
+  dm_fclose: new function
 
 Version 1.02.21 - 13th July 2007
 ================================
--- device-mapper/lib/.exported_symbols	2007/04/27 18:40:23	1.29
+++ device-mapper/lib/.exported_symbols	2007/07/24 14:15:45	1.30
@@ -1,6 +1,7 @@
 dm_lib_release
 dm_lib_exit
 dm_driver_version
+dm_fclose
 dm_get_library_version
 dm_log
 dm_log_init
--- device-mapper/lib/libdevmapper.h	2007/04/27 18:40:23	1.70
+++ device-mapper/lib/libdevmapper.h	2007/07/24 14:15:45	1.71
@@ -27,6 +27,7 @@
 #include <limits.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 /*****************************************************************
  * The first section of this file provides direct access to the 
@@ -623,6 +624,21 @@
  */
 char *dm_basename(const char *path);
 
+/**************************
+ * file/stream manipulation
+ **************************/
+
+/*
+ * Close a stream, with nicer error checking than fclose's.
+ * Derived from gnulib's close-stream.c.
+ *
+ * Close "stream".  Return 0 if successful, and EOF (setting errno)
+ * otherwise.  Upon failure, set errno to 0 if the error number
+ * cannot be determined.  Useful mainly for writable streams.
+ */
+int dm_fclose(FILE *stream);
+
+
 /*
  * Returns size of a buffer which is allocated with dm_malloc.
  * Pointer to the buffer is stored in *buf.
--- device-mapper/lib/libdm-file.c	2006/05/10 16:23:41	1.4
+++ device-mapper/lib/libdm-file.c	2007/07/24 14:15:45	1.5
@@ -72,3 +72,16 @@
 	return 0;
 }
 
+int dm_fclose(FILE *stream)
+{
+	int prev_fail = ferror(stream);
+	int fclose_fail = fclose(stream);
+
+	/* If there was a previous failure, but fclose succeeded,
+	   clear errno, since ferror does not set it, and its value
+	   may be unrelated to the ferror-reported failure.  */
+	if (prev_fail && !fclose_fail)
+		errno = 0;
+
+	return prev_fail || fclose_fail ? EOF : 0;
+}

             reply	other threads:[~2007-07-24 14:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 14:15 meyering [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-20  0:11 device-mapper ./WHATS_NEW lib/.exported_symbol agk
2007-07-28 10:48 meyering
2007-01-09 19:44 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070724141546.18751.qmail@sourceware.org \
    --to=meyering@sourceware.org \
    --cc=dm-cvs@sourceware.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.