1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

More warning fixes for Solaris.

Jeremy.
This commit is contained in:
Jeremy Allison 2009-02-23 16:22:43 -08:00
parent bcd6e5ec33
commit faa1100d22
17 changed files with 67 additions and 74 deletions

View File

@ -84,9 +84,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
char buff[8192];
int fd, i, n;
struct ifreq *ifr=NULL;
struct in_addr ipaddr;
struct in_addr nmask;
char *iname;
struct ifaddrs *curif;
struct ifaddrs *lastif = NULL;
@ -164,9 +161,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
char buff[8192];
int fd, i, n;
struct ifreq *ifr=NULL;
struct in_addr ipaddr;
struct in_addr nmask;
char *iname;
struct ifaddrs *curif;
struct ifaddrs *lastif = NULL;
@ -265,9 +259,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
int fd, i;
struct ifconf ifc;
struct ifreq *ifr=NULL;
struct in_addr ipaddr;
struct in_addr nmask;
char *iname;
struct ifaddrs *curif;
struct ifaddrs *lastif = NULL;

View File

@ -1784,13 +1784,13 @@ static struct file_list {
Free a file_list structure.
****************************************************************************/
static void free_file_list (struct file_list *list_head)
static void free_file_list (struct file_list *l_head)
{
struct file_list *list, *next;
for (list = list_head; list; list = next) {
for (list = l_head; list; list = next) {
next = list->next;
DLIST_REMOVE(list_head, list);
DLIST_REMOVE(l_head, list);
SAFE_FREE(list->file_path);
SAFE_FREE(list);
}

View File

@ -19,13 +19,11 @@
#include "includes.h"
#if HAVE_LDAP
#if defined(HAVE_LDAP) && defined(HAVE_LBER_LOG_PRINT_FN)
static void samba_ldap_log_print_fn(LDAP_CONST char *data)
{
DEBUG(lp_ldap_debug_threshold(), ("[LDAP] %s", data));
}
#endif
void init_ldap_debugging(void)

View File

@ -581,7 +581,9 @@ static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
int smb_ldap_start_tls(LDAP *ldap_struct, int version)
{
#ifdef LDAP_OPT_X_TLS
int rc;
#endif
if (lp_ldap_ssl() != LDAP_SSL_START_TLS) {
return LDAP_SUCCESS;

View File

@ -2008,7 +2008,6 @@ static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size)
static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
{
ssize_t len = 0;
int stop = 0;
DIR *dirp;
struct dirent *de;
int newfd = dup(attrdirfd);
@ -2080,7 +2079,7 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode)
{
int filedes = openat(fildes, path, oflag, mode);
if (filedes == -1) {
DEBUG(10,("openat FAILED: fd: %s, path: %s, errno: %s\n",filedes,path,strerror(errno)));
DEBUG(10,("openat FAILED: fd: %d, path: %s, errno: %s\n",filedes,path,strerror(errno)));
if (errno == EINVAL) {
errno = ENOTSUP;
} else {

View File

@ -118,7 +118,8 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn)
/* parent */
DEBUG(10, ("tdb_validate: fork succeeded, child PID = %d\n",child_pid));
DEBUG(10, ("tdb_validate: fork succeeded, child PID = %u\n",
(unsigned int)child_pid));
DEBUG(10, ("tdb_validate: waiting for child to finish...\n"));
while ((wait_pid = sys_waitpid(child_pid, &child_status, 0)) < 0) {
@ -134,7 +135,7 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn)
}
if (wait_pid != child_pid) {
DEBUG(1, ("tdb_validate: waitpid returned pid %d, "
"but %d was expected\n", wait_pid, child_pid));
"but %u was expected\n", wait_pid, (unsigned int)child_pid));
goto done;
}

View File

@ -1519,7 +1519,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
return -1;
}
DEBUG(4, ("smbc_chmod(%s, 0%3o)\n", fname, newmode));
DEBUG(4, ("smbc_chmod(%s, 0%3o)\n", fname, (unsigned int)newmode));
if (SMBC_parse_path(frame,
context,

View File

@ -310,7 +310,7 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: chmod %s mode 0x%x %s %s\n",
path, mode,
path, (unsigned int)mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
@ -330,7 +330,7 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: chmod_acl %s mode 0x%x %s %s\n",
path, mode,
path, (unsigned int)mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
@ -350,7 +350,7 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: fchmod %s mode 0x%x %s %s",
fsp->fsp_name, mode,
fsp->fsp_name, (unsigned int)mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
@ -370,7 +370,7 @@ static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: fchmod_acl %s mode 0x%x %s %s",
fsp->fsp_name, mode,
fsp->fsp_name, (unsigned int)mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));

View File

@ -412,18 +412,18 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
const struct sockaddr_storage *pss;
const struct in_addr *local_ip;
DEBUG(10, ("Received send_packet from %d\n", procid_to_pid(&src)));
DEBUG(10, ("Received send_packet from %u\n", (unsigned int)procid_to_pid(&src)));
if (data->length != sizeof(struct packet_struct)) {
DEBUG(2, ("Discarding invalid packet length from %d\n",
procid_to_pid(&src)));
DEBUG(2, ("Discarding invalid packet length from %u\n",
(unsigned int)procid_to_pid(&src)));
return;
}
if ((p->packet_type != NMB_PACKET) &&
(p->packet_type != DGRAM_PACKET)) {
DEBUG(2, ("Discarding invalid packet type from %d: %d\n",
procid_to_pid(&src), p->packet_type));
DEBUG(2, ("Discarding invalid packet type from %u: %d\n",
(unsigned int)procid_to_pid(&src), p->packet_type));
return;
}
@ -431,8 +431,8 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
pss = iface_ip((struct sockaddr *)&ss);
if (pss == NULL) {
DEBUG(2, ("Could not find ip for packet from %d\n",
procid_to_pid(&src)));
DEBUG(2, ("Could not find ip for packet from %u\n",
(unsigned int)procid_to_pid(&src)));
return;
}

View File

@ -1440,7 +1440,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
"create_disposition = 0x%x create_options=0x%x "
"unix mode=0%o oplock_request=%d\n",
fname, new_dos_attributes, access_mask, share_access,
create_disposition, create_options, unx_mode,
create_disposition, create_options, (unsigned int)unx_mode,
oplock_request));
if ((req == NULL) && ((oplock_request & INTERNAL_OPEN_ONLY) == 0)) {

View File

@ -719,12 +719,12 @@ static struct pai_val *load_inherited_info(const struct connection_struct *conn,
Count a linked list of canonical ACE entries.
****************************************************************************/
static size_t count_canon_ace_list( canon_ace *list_head )
static size_t count_canon_ace_list( canon_ace *l_head )
{
size_t count = 0;
canon_ace *ace;
for (ace = list_head; ace; ace = ace->next)
for (ace = l_head; ace; ace = ace->next)
count++;
return count;
@ -734,13 +734,13 @@ static size_t count_canon_ace_list( canon_ace *list_head )
Free a linked list of canonical ACE entries.
****************************************************************************/
static void free_canon_ace_list( canon_ace *list_head )
static void free_canon_ace_list( canon_ace *l_head )
{
canon_ace *list, *next;
for (list = list_head; list; list = next) {
for (list = l_head; list; list = next) {
next = list->next;
DLIST_REMOVE(list_head, list);
DLIST_REMOVE(l_head, list);
SAFE_FREE(list);
}
}
@ -916,7 +916,7 @@ static bool identity_in_ace_equal(canon_ace *ace1, canon_ace *ace2)
static void merge_aces( canon_ace **pp_list_head )
{
canon_ace *list_head = *pp_list_head;
canon_ace *l_head = *pp_list_head;
canon_ace *curr_ace_outer;
canon_ace *curr_ace_outer_next;
@ -925,7 +925,7 @@ static void merge_aces( canon_ace **pp_list_head )
* with identical SIDs.
*/
for (curr_ace_outer = list_head; curr_ace_outer; curr_ace_outer = curr_ace_outer_next) {
for (curr_ace_outer = l_head; curr_ace_outer; curr_ace_outer = curr_ace_outer_next) {
canon_ace *curr_ace;
canon_ace *curr_ace_next;
@ -947,7 +947,7 @@ static void merge_aces( canon_ace **pp_list_head )
/* Merge two allow or two deny ACE's. */
curr_ace_outer->perms |= curr_ace->perms;
DLIST_REMOVE(list_head, curr_ace);
DLIST_REMOVE(l_head, curr_ace);
SAFE_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
}
@ -960,7 +960,7 @@ static void merge_aces( canon_ace **pp_list_head )
* appears only once in the list.
*/
for (curr_ace_outer = list_head; curr_ace_outer; curr_ace_outer = curr_ace_outer_next) {
for (curr_ace_outer = l_head; curr_ace_outer; curr_ace_outer = curr_ace_outer_next) {
canon_ace *curr_ace;
canon_ace *curr_ace_next;
@ -992,7 +992,7 @@ static void merge_aces( canon_ace **pp_list_head )
* The deny overrides the allow. Remove the allow.
*/
DLIST_REMOVE(list_head, curr_ace);
DLIST_REMOVE(l_head, curr_ace);
SAFE_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
@ -1008,7 +1008,7 @@ static void merge_aces( canon_ace **pp_list_head )
* before we can get to an allow ace.
*/
DLIST_REMOVE(list_head, curr_ace_outer);
DLIST_REMOVE(l_head, curr_ace_outer);
SAFE_FREE(curr_ace_outer);
break;
}
@ -1019,7 +1019,7 @@ static void merge_aces( canon_ace **pp_list_head )
/* We may have modified the list. */
*pp_list_head = list_head;
*pp_list_head = l_head;
}
/****************************************************************************
@ -2305,12 +2305,12 @@ static bool unpack_canon_ace(files_struct *fsp,
static void arrange_posix_perms(const char *filename, canon_ace **pp_list_head)
{
canon_ace *list_head = *pp_list_head;
canon_ace *l_head = *pp_list_head;
canon_ace *owner_ace = NULL;
canon_ace *other_ace = NULL;
canon_ace *ace = NULL;
for (ace = list_head; ace; ace = ace->next) {
for (ace = l_head; ace; ace = ace->next) {
if (ace->type == SMB_ACL_USER_OBJ)
owner_ace = ace;
else if (ace->type == SMB_ACL_OTHER) {
@ -2331,16 +2331,16 @@ static void arrange_posix_perms(const char *filename, canon_ace **pp_list_head)
*/
if (owner_ace) {
DLIST_PROMOTE(list_head, owner_ace);
DLIST_PROMOTE(l_head, owner_ace);
}
if (other_ace) {
DLIST_DEMOTE(list_head, other_ace, canon_ace *);
DLIST_DEMOTE(l_head, other_ace, canon_ace *);
}
/* We have probably changed the head of the list. */
*pp_list_head = list_head;
*pp_list_head = l_head;
}
/****************************************************************************
@ -2353,7 +2353,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
const DOM_SID *powner, const DOM_SID *pgroup, struct pai_val *pal, SMB_ACL_TYPE_T the_acl_type)
{
mode_t acl_mask = (S_IRUSR|S_IWUSR|S_IXUSR);
canon_ace *list_head = NULL;
canon_ace *l_head = NULL;
canon_ace *ace = NULL;
canon_ace *next_ace = NULL;
int entry_id = SMB_ACL_FIRST_ENTRY;
@ -2457,14 +2457,14 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
ace->owner_type = owner_type;
ace->ace_flags = get_pai_flags(pal, ace, (the_acl_type == SMB_ACL_TYPE_DEFAULT));
DLIST_ADD(list_head, ace);
DLIST_ADD(l_head, ace);
}
/*
* This next call will ensure we have at least a user/group/world set.
*/
if (!ensure_canon_entry_valid(&list_head, conn->params,
if (!ensure_canon_entry_valid(&l_head, conn->params,
S_ISDIR(psbuf->st_mode), powner, pgroup,
psbuf, False))
goto fail;
@ -2476,7 +2476,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
DEBUG(10,("canonicalise_acl: %s ace entries before arrange :\n", the_acl_type == SMB_ACL_TYPE_ACCESS ? "Access" : "Default" ));
for ( ace_count = 0, ace = list_head; ace; ace = next_ace, ace_count++) {
for ( ace_count = 0, ace = l_head; ace; ace = next_ace, ace_count++) {
next_ace = ace->next;
/* Masks are only applied to entries other than USER_OBJ and OTHER. */
@ -2484,7 +2484,7 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
ace->perms &= acl_mask;
if (ace->perms == 0) {
DLIST_PROMOTE(list_head, ace);
DLIST_PROMOTE(l_head, ace);
}
if( DEBUGLVL( 10 ) ) {
@ -2492,15 +2492,15 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
}
}
arrange_posix_perms(fname,&list_head );
arrange_posix_perms(fname,&l_head );
print_canon_ace_list( "canonicalise_acl: ace entries after arrange", list_head );
print_canon_ace_list( "canonicalise_acl: ace entries after arrange", l_head );
return list_head;
return l_head;
fail:
free_canon_ace_list(list_head);
free_canon_ace_list(l_head);
return NULL;
}

View File

@ -212,7 +212,7 @@ static void remove_child_pid(pid_t pid, bool unclean_shutdown)
/* a child terminated uncleanly so tickle all processes to see
if they can grab any of the pending locks
*/
DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", pid));
DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", (unsigned int)pid));
messaging_send_buf(smbd_messaging_context(), procid_self(),
MSG_SMB_BRL_VALIDATE, NULL, 0);
message_send_all(smbd_messaging_context(),

View File

@ -1352,8 +1352,8 @@ static int shutdown_other_smbds(struct db_record *rec,
return 0;
}
DEBUG(0,("shutdown_other_smbds: shutting down pid %d "
"(IP %s)\n", procid_to_pid(&crec->pid), ip));
DEBUG(0,("shutdown_other_smbds: shutting down pid %u "
"(IP %s)\n", (unsigned int)procid_to_pid(&crec->pid), ip));
messaging_send(smbd_messaging_context(), crec->pid, MSG_SHUTDOWN,
&data_blob_null);

View File

@ -194,7 +194,8 @@ static int smb_download_dir(const char *base, const char *name, int resume)
}
if(chmod(relname, remotestat.st_mode) < 0) {
fprintf(stderr, "Unable to change mode of local dir %s to %o\n", relname, remotestat.st_mode);
fprintf(stderr, "Unable to change mode of local dir %s to %o\n", relname,
(unsigned int)remotestat.st_mode);
smbc_closedir(dirhandle);
return 0;
}
@ -471,7 +472,8 @@ static int smb_download_file(const char *base, const char *name, int recursive,
if(keep_permissions && !send_stdout) {
if(fchmod(localhandle, remotestat.st_mode) < 0) {
fprintf(stderr, "Unable to change mode of local file %s to %o\n", path, remotestat.st_mode);
fprintf(stderr, "Unable to change mode of local file %s to %o\n", path,
(unsigned int)remotestat.st_mode);
smbc_close(remotehandle);
close(localhandle);
return 0;

View File

@ -386,7 +386,7 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx,
if (child_pid != 0) {
/* parent */
DEBUG(5, ("winbind_msg_validate_cache: child created with "
"pid %d.\n", child_pid));
"pid %d.\n", (int)child_pid));
return;
}

View File

@ -2625,9 +2625,9 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
return;
DEBUG(10, ("Storing response for pid %d, len %d\n",
pid, response->length));
(int)pid, response->length));
fstr_sprintf(key_str, "DR/%d", pid);
fstr_sprintf(key_str, "DR/%d", (int)pid);
if (tdb_store(wcache->tdb, string_tdb_data(key_str),
make_tdb_data((uint8 *)response, sizeof(*response)),
TDB_REPLACE) == -1)
@ -2641,7 +2641,7 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
DEBUG(10, ("Storing extra data: len=%d\n",
(int)(response->length - sizeof(*response))));
fstr_sprintf(key_str, "DE/%d", pid);
fstr_sprintf(key_str, "DE/%d", (int)pid);
if (tdb_store(wcache->tdb, string_tdb_data(key_str),
make_tdb_data((uint8 *)response->extra_data.data,
response->length - sizeof(*response)),
@ -2651,7 +2651,7 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
/* We could not store the extra data, make sure the tdb does not
* contain a main record with wrong dangling extra data */
fstr_sprintf(key_str, "DR/%d", pid);
fstr_sprintf(key_str, "DR/%d", (int)pid);
tdb_delete(wcache->tdb, string_tdb_data(key_str));
return;
@ -2665,9 +2665,9 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
if (!init_wcache())
return false;
DEBUG(10, ("Retrieving response for pid %d\n", pid));
DEBUG(10, ("Retrieving response for pid %d\n", (int)pid));
fstr_sprintf(key_str, "DR/%d", pid);
fstr_sprintf(key_str, "DR/%d", (int)pid);
data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
if (data.dptr == NULL)
@ -2689,7 +2689,7 @@ bool cache_retrieve_response(pid_t pid, struct winbindd_response * response)
DEBUG(10, ("Retrieving extra data length=%d\n",
(int)(response->length - sizeof(*response))));
fstr_sprintf(key_str, "DE/%d", pid);
fstr_sprintf(key_str, "DE/%d", (int)pid);
data = tdb_fetch(wcache->tdb, string_tdb_data(key_str));
if (data.dptr == NULL) {
@ -2716,10 +2716,10 @@ void cache_cleanup_response(pid_t pid)
if (!init_wcache())
return;
fstr_sprintf(key_str, "DR/%d", pid);
fstr_sprintf(key_str, "DR/%d", (int)pid);
tdb_delete(wcache->tdb, string_tdb_data(key_str));
fstr_sprintf(key_str, "DE/%d", pid);
fstr_sprintf(key_str, "DE/%d", (int)pid);
tdb_delete(wcache->tdb, string_tdb_data(key_str));
return;

View File

@ -183,7 +183,7 @@ static void async_request_timeout_handler(struct event_context *ctx,
DEBUG(0,("async_request_timeout_handler: child pid %u is not responding. "
"Closing connection to it.\n",
state->child_pid ));
(unsigned int)state->child_pid ));
/* Deal with the reply - set to error. */
async_reply_recv(private_data, False);