From: Pierangelo Masarati Date: Mon, 25 Feb 2008 16:14:45 +0000 (+0000) Subject: detect write errors (ITS#5387) X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~131 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=282fccbb3e4694276ed714ba7e02dded8486c664;p=openldap detect write errors (ITS#5387) --- diff --git a/servers/slapd/slapcat.c b/servers/slapd/slapcat.c index bdda32b0e4..b8da193d30 100644 --- a/servers/slapd/slapcat.c +++ b/servers/slapd/slapcat.c @@ -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 );