From 63602d15afe96206e1fdcea4d2b9014582aa41aa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 28 Apr 2001 14:01:02 +0000 Subject: - fixed some compiler warnings - fixed slprintf and vsprintf macros (This used to be commit c986a3c51e8cdbc1230edbe0f4a91138c4ada29d) --- source3/include/includes.h | 18 ++++++++++++------ source3/include/proto.h | 4 ---- source3/libsmb/clisecdesc.c | 2 +- source3/passdb/passdb.c | 5 +++-- source3/smbd/reply.c | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/source3/include/includes.h b/source3/include/includes.h index a5fa555058..e2edb512ae 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -54,6 +54,13 @@ #endif #endif +/* use gcc attribute to check printf fns */ +#ifdef __GNUC__ +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) +#endif + #ifdef RELIANTUNIX /* * has to be included before any other to get @@ -995,12 +1002,6 @@ extern int DEBUGLEVEL; #endif /* add varargs prototypes with printf checking */ -#ifdef __GNUC__ -#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) -#else -#define PRINTF_ATTRIBUTE(a1, a2) -#endif - int fdprintf(int , char *, ...) PRINTF_ATTRIBUTE(2,3); #ifndef HAVE_SNPRINTF int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); @@ -1009,5 +1010,10 @@ int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); int asprintf(char **,char *, ...) PRINTF_ATTRIBUTE(2,3); #endif +/* we used to use these fns, but now we have good replacements + for snprintf and vsnprintf */ +#define slprintf snprintf +#define vslprintf vsnprintf + #endif /* _INCLUDES_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index 62f8df2b03..12a63ca23c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -213,10 +213,6 @@ void CatchSignal(int signum,void (*handler)(int )); void CatchChild(void); void CatchChildLeaveStatus(void); -/*The following definitions come from lib/slprintf.c */ - -int vslprintf(char *str, int n, char *format, va_list ap); - /*The following definitions come from lib/smbrun.c */ int smbrun(char *cmd, int *outfd); diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c index 0b52d62513..6824a0edf4 100644 --- a/source3/libsmb/clisecdesc.c +++ b/source3/libsmb/clisecdesc.c @@ -33,7 +33,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd) char param[8]; char *rparam=NULL, *rdata=NULL; int rparam_count=0, rdata_count=0; - TALLOC_CTX *mem_ctx; + TALLOC_CTX *mem_ctx=NULL; prs_struct pd; SEC_DESC *psd = NULL; diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 6636285b6f..0e0f9908dc 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -108,7 +108,8 @@ void pdb_init_sam(SAM_ACCOUNT *user) ZERO_STRUCTP(user); user->mem_ctx = talloc_init(); - DEBUG(10, ("pdb_init_sam: obtained a talloc context of 0x%x\n", user->mem_ctx)); + DEBUG(10, ("pdb_init_sam: obtained a talloc context of 0x%x\n", + (unsigned)user->mem_ctx)); user->logon_time = (time_t)0; user->logoff_time = (time_t)-1; @@ -134,7 +135,7 @@ void pdb_clear_sam(SAM_ACCOUNT *user) return; /* free upany memory used */ - DEBUG(10, ("pdb_clear_sam: releasing memory. talloc context is 0x%x\n",user->mem_ctx)); + DEBUG(10, ("pdb_clear_sam: releasing memory. talloc context is 0x%x\n",(unsigned)user->mem_ctx)); talloc_destroy (user->mem_ctx); /* now initialize */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 15e8e9537e..61b9390d08 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -556,7 +556,7 @@ static BOOL check_server_security(char *orig_user, char *domain, char *unix_user smb_apasswd, smb_apasslen, smb_ntpasswd, smb_ntpasslen); if(ret) { - struct passwd *pwd; + struct passwd *pwd=NULL; /* * User validated ok against Domain controller. @@ -597,7 +597,7 @@ static BOOL check_domain_security(char *orig_user, char *domain, char *unix_user { BOOL ret = False; BOOL user_exists = True; - struct passwd *pwd; + struct passwd *pwd=NULL; if(lp_security() != SEC_DOMAIN) return False; -- cgit