]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slaptest.c
coverity scan, fix typo
[openldap] / servers / slapd / slaptest.c
index 245389223006170efbd49f1d80876b6e30ad5955..ca10c7a6c7e2543192b227d47926f20158c13b87 100644 (file)
@@ -1,6 +1,6 @@
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004-2005 The OpenLDAP Foundation.
+ * Copyright 2004-2007 The OpenLDAP Foundation.
  * Portions Copyright 2004 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -45,7 +45,7 @@ test_file( const char *fname, const char *ftype )
 
        switch ( stat( fname, &st ) ) {
        case 0:
-               if ( !( st.st_mode & S_IWUSR ) ) {
+               if ( !( st.st_mode & S_IWRITE ) ) {
                        Debug( LDAP_DEBUG_ANY, "%s file "
                                "\"%s\" exists, but user does not have access\n",
                                ftype, fname, 0 );
@@ -69,6 +69,7 @@ test_file( const char *fname, const char *ftype )
 
                                return -1;
                        }
+                       fclose( fp );
                        unlink( fname );
                        break;
                }
@@ -79,6 +80,8 @@ test_file( const char *fname, const char *ftype )
                        save_errno, strerror( save_errno ) );
                return -1;
        }
+
+       return 0;
 }
 
 int