#include <ac/assert.h>
#include <sys/types.h>
#include <sys/stat.h>
+#if HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
#include <fcntl.h>
#ifdef _WIN32
int entry_length;
char * entry_as_string;
- openres = open(path->bv_val, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR | S_IWUSR);
+ openres = open(path->bv_val, O_WRONLY|O_CREAT|O_TRUNC, S_IREAD | S_IWRITE);
if(openres == -1) {
if(errno == ENOENT)
rs = LDAP_NO_SUCH_OBJECT;
#include <sys/types.h>
#include <sys/stat.h>
+
+#ifndef S_ISREG
+#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
+#endif
+
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "slap.h"
#ifdef LDAP_SLAPI
static unsigned int
retcode_sleep( int s )
{
+ unsigned int r = 0;
+
/* sleep as required */
if ( s < 0 ) {
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
- unsigned r = rand() % (-s);
+ r = rand() % (-s);
#endif
- unsigned r = ((double)(-s))*rand()/(RAND_MAX + 1.0);
- return sleep( r );
+ r = ((double)(-s))*rand()/(RAND_MAX + 1.0);
+ } else if ( s > 0 ) {
+ r = (unsigned int)s;
}
-
- if ( s > 0 ) {
- return sleep( (unsigned int)s );
+ if ( r ) {
+ sleep( r );
}
- return 0;
+ return r;
}
static int
exit( EXIT_FAILURE );
}
+#ifdef LDAP_SYSLOG
if ( syslog_unknowns ) {
rc = parse_debug_unknowns( syslog_unknowns, &ldap_syslog );
ldap_charray_free( syslog_unknowns );
if ( rc )
exit( EXIT_FAILURE );
}
+#endif
at_oc_cache = 1;
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 );