]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapcat.c
ITS#5339
[openldap] / servers / slapd / slapcat.c
index a87c8eb32543b8c583623f6550668a7146934f40..6ea1952006502541080756408981bf00ea2f8039 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * Portions Copyright 1998-2003 Kurt D. Zeilenga.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
@@ -32,7 +32,7 @@
 #include "slapcommon.h"
 #include "ldif.h"
 
-static int gotsig;
+static volatile sig_atomic_t gotsig;
 
 static RETSIGTYPE
 slapcat_sig( int sig )
@@ -123,8 +123,13 @@ slapcat( int argc, char **argv )
                        break;
                }
 
-               fputs( data, ldiffp->fp );
-               fputs( "\n", ldiffp->fp );
+               if ( fputs( data, ldiffp->fp ) == EOF ||
+                       fputs( "\n", ldiffp->fp ) == EOF ) {
+                       fprintf(stderr, "%s: error writing output.\n",
+                               progname);
+                       rc = EXIT_FAILURE;
+                       break;
+               }
        }
 
        be->be_entry_close( be );