]> git.sur5r.net Git - openldap/commitdiff
detect write errors (ITS#5387)
authorPierangelo Masarati <ando@openldap.org>
Mon, 25 Feb 2008 16:14:45 +0000 (16:14 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 25 Feb 2008 16:14:45 +0000 (16:14 +0000)
servers/slapd/slapcat.c

index bdda32b0e42eadc0367da2481376a79e8cebbf43..b8da193d30f96cf205d8ab27a4f7a0d935c51900 100644 (file)
@@ -84,6 +84,7 @@ slapcat( int argc, char **argv )
                char *data;
                int len;
                Entry* e;
+               int writerc;
 
                if ( gotsig )
                        break;
@@ -123,8 +124,21 @@ slapcat( int argc, char **argv )
                        break;
                }
 
-               fputs( data, ldiffp->fp );
-               fputs( "\n", ldiffp->fp );
+               writerc = fputs( data, ldiffp->fp );
+               if ( writerc == EOF ) {
+                       fprintf(stderr, "%s: error writing output.\n",
+                               progname);
+                       rc = EXIT_FAILURE;
+                       break;
+               }
+
+               writerc = fputs( "\n", ldiffp->fp );
+               if ( writerc == EOF ) {
+                       fprintf(stderr, "%s: error writing output.\n",
+                               progname);
+                       rc = EXIT_FAILURE;
+                       break;
+               }
        }
 
        be->be_entry_close( be );