]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/fork.c
Merge branch 'mdb.master' of ssh://git-master.openldap.org/~git/git/openldap
[openldap] / servers / slapd / back-shell / fork.c
index 5f46a2a75a10cead373f68b67a301c3a014d89ef..63b348ca2ea87771bba0b745aca4ca73a303ecc9 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -103,7 +103,12 @@ forkandexec(
        if ( (*rfp = fdopen( c2p[0], "r" )) == NULL || (*wfp = fdopen( p2c[1],
            "w" )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "fdopen failed\n", 0, 0, 0 );
-               close( c2p[0] );
+               if ( *rfp ) {
+                       fclose( *rfp );
+                       *rfp = NULL;
+               } else {
+                       close( c2p[0] );
+               }
                close( p2c[1] );
 
                return( -1 );