mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Portability cleanups
This commit is contained in:
parent
811a90d5e1
commit
3f4e196beb
@ -32,7 +32,9 @@
|
||||
#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
|
||||
|
@ -181,7 +181,7 @@ static int spew_entry(Entry * e, struct berval * path) {
|
||||
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;
|
||||
|
@ -36,7 +36,14 @@
|
||||
|
||||
#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
|
||||
|
@ -93,20 +93,22 @@ retcode_entry_response( Operation *op, SlapReply *rs, BackendInfo *bi, Entry *e
|
||||
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 ( r ) {
|
||||
sleep( r );
|
||||
}
|
||||
|
||||
if ( s > 0 ) {
|
||||
return sleep( (unsigned int)s );
|
||||
}
|
||||
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -517,6 +517,7 @@ slap_tool_init(
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
#ifdef LDAP_SYSLOG
|
||||
if ( syslog_unknowns ) {
|
||||
rc = parse_debug_unknowns( syslog_unknowns, &ldap_syslog );
|
||||
ldap_charray_free( syslog_unknowns );
|
||||
@ -524,6 +525,7 @@ slap_tool_init(
|
||||
if ( rc )
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
#endif
|
||||
|
||||
at_oc_cache = 1;
|
||||
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user