mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
Merge remote branch 'martins/warnings'
(This used to be ctdb commit 58a1e25e1c563ebede57eea2e8f4e2c5785d01bf)
This commit is contained in:
commit
1f9b9bc614
@ -37,7 +37,7 @@ CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
|
||||
-I@tallocdir@ -I@tdbdir@/include -I@libreplacedir@ \
|
||||
-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
|
||||
-DLOGDIR=\"$(logdir)\" \
|
||||
-DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
|
||||
-DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ -Wno-format-zero-length $(POPT_CFLAGS)
|
||||
|
||||
LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
|
||||
|
||||
@ -147,7 +147,7 @@ utils/smnotify/smnotify.h: utils/smnotify/smnotify.x
|
||||
|
||||
utils/smnotify/gen_xdr.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
|
||||
@echo Generating $@
|
||||
rpcgen -c utils/smnotify/smnotify.x > utils/smnotify/gen_xdr.c
|
||||
rpcgen -c utils/smnotify/smnotify.x | grep -Ev '^[[:space:]]+register int32_t \*buf;' > utils/smnotify/gen_xdr.c
|
||||
|
||||
utils/smnotify/gen_smnotify.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
|
||||
@echo Generating $@
|
||||
|
@ -388,6 +388,9 @@ static struct ctdb_client_call_state *ctdb_client_call_local_send(struct ctdb_db
|
||||
state->ctdb_db = ctdb_db;
|
||||
|
||||
ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
@ -916,6 +919,9 @@ static void invoke_control_callback(struct event_context *ev, struct timed_event
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_DEBUG,("ctdb_control_recv() failed, ignoring return code %d\n", ret));
|
||||
}
|
||||
|
||||
talloc_free(tmp_ctx);
|
||||
}
|
||||
|
@ -64,21 +64,6 @@ int ctdb_queue_length(struct ctdb_queue *queue)
|
||||
return queue->out_queue_length;
|
||||
}
|
||||
|
||||
static void dump_packet(unsigned char *data, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
char *p = talloc_array(NULL, char, len*3 + 1);
|
||||
if (!p) {
|
||||
DEBUG(DEBUG_CRIT,("Packet talloc fail"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
sprintf(p + i*3, " %02x", data[i]);
|
||||
DEBUG(DEBUG_CRIT,("Contents: %s\n", p));
|
||||
talloc_free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
called when an incoming connection is readable
|
||||
This function MUST be safe for reentry via the queue callback!
|
||||
|
@ -368,7 +368,9 @@ static int execCommand(poptContext con)
|
||||
poptItem item = con->doExec;
|
||||
const char ** argv;
|
||||
int argc = 0;
|
||||
#if defined(__hpux) || defined(HAVE_SETUID) || defined(HAVE_SETREUID)
|
||||
int rc;
|
||||
#endif
|
||||
|
||||
if (item == NULL) /*XXX can't happen*/
|
||||
return POPT_ERROR_NOARG;
|
||||
@ -444,7 +446,7 @@ if (_popt_debug)
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = execvp(argv[0], (char *const *)argv);
|
||||
(void) execvp(argv[0], (char *const *)(intptr_t)argv);
|
||||
|
||||
return POPT_ERROR_ERRNO;
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ static void configLine(poptContext con, char * line)
|
||||
|
||||
int poptReadConfigFile(poptContext con, const char * fn)
|
||||
{
|
||||
const char * file, * chptr, * end;
|
||||
char * file;
|
||||
const char * chptr, * end;
|
||||
char * buf;
|
||||
/*@dependent@*/ char * dst;
|
||||
int fd, rc;
|
||||
|
@ -18,7 +18,7 @@
|
||||
_free(/*@only@*/ /*@null@*/ const void * p)
|
||||
/*@modifies p @*/
|
||||
{
|
||||
if (p != NULL) free((void *)p);
|
||||
if (p != NULL) free((void *)(intptr_t)p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
|
||||
AC_TRY_RUN([
|
||||
#define test_readdir_os2_delete main
|
||||
#include "$libreplacedir/tests/os2_delete.c"],
|
||||
#include "$libreplacedir/test/os2_delete.c"],
|
||||
[libreplace_cv_READDIR_NEEDED=no],
|
||||
[libreplace_cv_READDIR_NEEDED=yes],
|
||||
[libreplace_cv_READDIR_NEEDED="assuming not"])
|
||||
@ -34,7 +34,7 @@ AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READD
|
||||
#define _LIBREPLACE_REPLACE_H
|
||||
#include "$libreplacedir/repdir_getdirentries.c"
|
||||
#define test_readdir_os2_delete main
|
||||
#include "$libreplacedir/tests/os2_delete.c"],
|
||||
#include "$libreplacedir/test/os2_delete.c"],
|
||||
[libreplace_cv_READDIR_GETDIRENTRIES=yes],
|
||||
[libreplace_cv_READDIR_GETDIRENTRIES=no])
|
||||
])
|
||||
@ -57,7 +57,7 @@ AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GE
|
||||
#error _donot_use_getdents_replacement_anymore
|
||||
#include "$libreplacedir/repdir_getdents.c"
|
||||
#define test_readdir_os2_delete main
|
||||
#include "$libreplacedir/tests/os2_delete.c"],
|
||||
#include "$libreplacedir/test/os2_delete.c"],
|
||||
[libreplace_cv_READDIR_GETDENTS=yes],
|
||||
[libreplace_cv_READDIR_GETDENTS=no])
|
||||
])
|
||||
|
173
ctdb/lib/replace/test/strptime.c
Normal file
173
ctdb/lib/replace/test/strptime.c
Normal file
@ -0,0 +1,173 @@
|
||||
|
||||
#ifdef LIBREPLACE_CONFIGURE_TEST_STRPTIME
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#ifndef __STRING
|
||||
#define __STRING(x) #x
|
||||
#endif
|
||||
|
||||
/* make printf a no-op */
|
||||
#define printf if(0) printf
|
||||
|
||||
#else /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */
|
||||
|
||||
#include "replace.h"
|
||||
#include "system/time.h"
|
||||
#include "replace-test.h"
|
||||
|
||||
#endif /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */
|
||||
|
||||
int libreplace_test_strptime(void)
|
||||
{
|
||||
const char *s = "20070414101546Z";
|
||||
char *ret;
|
||||
struct tm t, t2;
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
memset(&t2, 0, sizeof(t2));
|
||||
|
||||
printf("test: strptime\n");
|
||||
|
||||
ret = strptime(s, "%Y%m%d%H%M%S", &t);
|
||||
if ( ret == NULL ) {
|
||||
printf("failure: strptime [\n"
|
||||
"returned NULL\n"
|
||||
"]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( *ret != 'Z' ) {
|
||||
printf("failure: strptime [\n"
|
||||
"ret doesn't point to 'Z'\n"
|
||||
"]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = strptime(s, "%Y%m%d%H%M%SZ", &t2);
|
||||
if ( ret == NULL ) {
|
||||
printf("failure: strptime [\n"
|
||||
"returned NULL with Z\n"
|
||||
"]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( *ret != '\0' ) {
|
||||
printf("failure: strptime [\n"
|
||||
"ret doesn't point to '\\0'\n"
|
||||
"]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
#define CMP_TM_ELEMENT(t1,t2,elem) \
|
||||
if (t1.elem != t2.elem) { \
|
||||
printf("failure: strptime [\n" \
|
||||
"result differs if the format string has a 'Z' at the end\n" \
|
||||
"element: %s %d != %d\n" \
|
||||
"]\n", \
|
||||
__STRING(elen), t1.elem, t2.elem); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
CMP_TM_ELEMENT(t,t2,tm_sec);
|
||||
CMP_TM_ELEMENT(t,t2,tm_min);
|
||||
CMP_TM_ELEMENT(t,t2,tm_hour);
|
||||
CMP_TM_ELEMENT(t,t2,tm_mday);
|
||||
CMP_TM_ELEMENT(t,t2,tm_mon);
|
||||
CMP_TM_ELEMENT(t,t2,tm_year);
|
||||
CMP_TM_ELEMENT(t,t2,tm_wday);
|
||||
CMP_TM_ELEMENT(t,t2,tm_yday);
|
||||
CMP_TM_ELEMENT(t,t2,tm_isdst);
|
||||
|
||||
if (t.tm_sec != 46) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_sec: expected: 46, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_sec);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_min != 15) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_min: expected: 15, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_min);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_hour != 10) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_hour: expected: 10, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_hour);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_mday != 14) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_mday: expected: 14, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_mday);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_mon != 3) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_mon: expected: 3, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_mon);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_year != 107) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_year: expected: 107, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_year);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_wday != 6) { /* saturday */
|
||||
printf("failure: strptime [\n"
|
||||
"tm_wday: expected: 6, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_wday);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t.tm_yday != 103) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_yday: expected: 103, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_yday);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* we don't test this as it depends on the host configuration
|
||||
if (t.tm_isdst != 0) {
|
||||
printf("failure: strptime [\n"
|
||||
"tm_isdst: expected: 0, got: %d\n"
|
||||
"]\n",
|
||||
t.tm_isdst);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
printf("success: strptime\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef LIBREPLACE_CONFIGURE_TEST_STRPTIME
|
||||
int main (void)
|
||||
{
|
||||
int ret;
|
||||
ret = libreplace_test_strptime();
|
||||
if (ret == false) return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -28,7 +28,9 @@
|
||||
#ifndef __TEVENT_H__
|
||||
#define __TEVENT_H__
|
||||
|
||||
#ifndef TEVENT_DEPRECATED
|
||||
#define TEVENT_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <talloc.h>
|
||||
@ -1262,6 +1264,7 @@ typedef int (*tevent_nesting_hook)(struct tevent_context *ev,
|
||||
void *stack_ptr,
|
||||
const char *location);
|
||||
#ifdef TEVENT_DEPRECATED
|
||||
#if (TEVENT_DEPRECATED_QUIET != 1)
|
||||
#ifndef _DEPRECATED_
|
||||
#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
|
||||
#define _DEPRECATED_ __attribute__ ((deprecated))
|
||||
@ -1269,6 +1272,10 @@ typedef int (*tevent_nesting_hook)(struct tevent_context *ev,
|
||||
#define _DEPRECATED_
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#undef _DEPRECATED_
|
||||
#define _DEPRECATED_
|
||||
#endif
|
||||
void tevent_loop_allow_nesting(struct tevent_context *ev) _DEPRECATED_;
|
||||
void tevent_loop_set_nesting_hook(struct tevent_context *ev,
|
||||
tevent_nesting_hook hook,
|
||||
|
@ -82,7 +82,6 @@ static uint32_t tevent_sig_count(struct tevent_sigcounter s)
|
||||
static void tevent_common_signal_handler(int signum)
|
||||
{
|
||||
char c = 0;
|
||||
ssize_t res;
|
||||
struct tevent_common_signal_list *sl;
|
||||
struct tevent_context *ev = NULL;
|
||||
int saved_errno = errno;
|
||||
@ -95,7 +94,7 @@ static void tevent_common_signal_handler(int signum)
|
||||
if (sl->se->event_ctx && sl->se->event_ctx != ev) {
|
||||
ev = sl->se->event_ctx;
|
||||
/* doesn't matter if this pipe overflows */
|
||||
res = write(ev->pipe_fds[1], &c, 1);
|
||||
(void) write(ev->pipe_fds[1], &c, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,9 +179,8 @@ static void signal_pipe_handler(struct tevent_context *ev, struct tevent_fd *fde
|
||||
uint16_t flags, void *_private)
|
||||
{
|
||||
char c[16];
|
||||
ssize_t res;
|
||||
/* its non-blocking, doesn't matter if we read too much */
|
||||
res = read(fde->fd, c, sizeof(c));
|
||||
(void) read(fde->fd, c, sizeof(c));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -937,6 +937,9 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_db_context *ctdb_db,
|
||||
state->ctdb_db = ctdb_db;
|
||||
|
||||
ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
|
||||
}
|
||||
|
||||
event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);
|
||||
|
||||
|
@ -257,7 +257,7 @@ store:
|
||||
if (schedule_for_deletion) {
|
||||
int ret2;
|
||||
ret2 = ctdb_local_schedule_for_deletion(ctdb_db, header, key);
|
||||
if (ret != 0) {
|
||||
if (ret2 != 0) {
|
||||
DEBUG(DEBUG_ERR, (__location__ " ctdb_local_schedule_for_deletion failed.\n"));
|
||||
}
|
||||
}
|
||||
|
@ -2195,7 +2195,6 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
||||
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
|
||||
struct ctdb_node_map *nodemap=NULL;
|
||||
TALLOC_CTX *tmp_ctx;
|
||||
uint32_t changed_flags;
|
||||
int i;
|
||||
struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
|
||||
int disabled_flag_changed;
|
||||
@ -2226,8 +2225,6 @@ static void monitor_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
||||
return;
|
||||
}
|
||||
|
||||
changed_flags = c->old_flags ^ c->new_flags;
|
||||
|
||||
if (nodemap->nodes[i].flags != c->new_flags) {
|
||||
DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
|
||||
}
|
||||
|
@ -234,7 +234,13 @@ int main(int argc, const char *argv[])
|
||||
|
||||
/* setup a ctdb call function */
|
||||
ret = ctdb_set_call(ctdb_db, incr_func, FUNC_INCR);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_DEBUG,("ctdb_set_call() failed, ignoring return code %d\n", ret));
|
||||
}
|
||||
ret = ctdb_set_call(ctdb_db, fetch_func, FUNC_FETCH);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_DEBUG,("ctdb_set_call() failed, ignoring return code %d\n", ret));
|
||||
}
|
||||
|
||||
if (ctdb_client_set_message_handler(ctdb, 0, ring_message_handler,&msg_count))
|
||||
goto error;
|
||||
|
@ -115,7 +115,6 @@ int main(int argc, const char *argv[])
|
||||
const char **extra_argv;
|
||||
int extra_argc = 0;
|
||||
poptContext pc;
|
||||
struct event_context *ev;
|
||||
int i,j,k;
|
||||
trbt_tree_t *tree;
|
||||
uint32_t *data;
|
||||
@ -146,9 +145,6 @@ int main(int argc, const char *argv[])
|
||||
while (extra_argv[extra_argc]) extra_argc++;
|
||||
}
|
||||
|
||||
ev = event_context_init(NULL);
|
||||
|
||||
|
||||
printf("testing trbt_insert32_callback for %d records\n", num_records);
|
||||
memctx = talloc_new(NULL);
|
||||
u32array = talloc_array(memctx, uint32_t *, num_records);
|
||||
|
@ -230,7 +230,7 @@ int scsi_inquiry(int fd)
|
||||
unsigned int sense_len=32;
|
||||
unsigned char sense[sense_len];
|
||||
|
||||
int res, alen, i;
|
||||
int res, i;
|
||||
|
||||
cdb[3]=(data_size>>8)&0xff;
|
||||
cdb[4]=data_size&0xff;
|
||||
@ -273,9 +273,6 @@ int scsi_inquiry(int fd)
|
||||
!!(data[3]&0x10),
|
||||
data[3]&0x0f);
|
||||
|
||||
/* Additional Length */
|
||||
alen=data[4];
|
||||
|
||||
switch(data[3]&0x0f){
|
||||
/*SPC-2/SPC-3/SPC-4*/
|
||||
case 2:
|
||||
|
Loading…
x
Reference in New Issue
Block a user