From b1ce226af8b61ad7e3c37860a59c6715012e738b Mon Sep 17 00:00:00 2001 From: James Peach Date: Fri, 15 Jun 2007 21:58:49 +0000 Subject: r23510: Tidy calls to smb_panic by removing trailing newlines. Print the failed expression in SMB_ASSERT. (This used to be commit 171dc060e2a576d724eed1ca65636bdafffd7713) --- source3/lib/charcnv.c | 2 +- source3/lib/data_blob.c | 4 ++-- source3/lib/select.c | 4 ++-- source3/lib/smbldap.c | 15 +++++---------- source3/lib/system_smbd.c | 4 +--- source3/lib/util.c | 24 ++++++++++++++---------- source3/lib/util_pw.c | 2 +- source3/lib/util_tdb.c | 4 ++-- 8 files changed, 28 insertions(+), 31 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 8d5fbc8118..35343b2f0a 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -168,7 +168,7 @@ void init_iconv(void) conv_handles[c1][c2] = smb_iconv_open(n2,n1); if (!conv_handles[c1][c2]) { DEBUG(0,("init_iconv: Conversion from %s to %s failed", n1, n2)); - smb_panic("init_iconv: conv_handle initialization failed."); + smb_panic("init_iconv: conv_handle initialization failed"); } } } diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index 6ed48888a8..ebe97230e4 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -74,11 +74,11 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length) if (p) { ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length); if (ret.data == NULL) - smb_panic("data_blob_talloc: TALLOC_MEMDUP failed.\n"); + smb_panic("data_blob_talloc: TALLOC_MEMDUP failed"); } else { ret.data = (uint8 *)TALLOC(mem_ctx, length); if (ret.data == NULL) - smb_panic("data_blob_talloc: talloc failed.\n"); + smb_panic("data_blob_talloc: TALLOC failed"); } ret.length = length; diff --git a/source3/lib/select.c b/source3/lib/select.c index f63221f7cf..e8900a383c 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -71,9 +71,9 @@ int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, s */ if(set_blocking(select_pipe[0],0)==-1) - smb_panic("select_pipe[0]: O_NONBLOCK failed.\n"); + smb_panic("select_pipe[0]: O_NONBLOCK failed"); if(set_blocking(select_pipe[1],0)==-1) - smb_panic("select_pipe[1]: O_NONBLOCK failed.\n"); + smb_panic("select_pipe[1]: O_NONBLOCK failed"); initialised = sys_getpid(); } diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index f8cb8f4a25..1cfb5f89a7 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -409,9 +409,8 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods == NULL) { mods = SMB_MALLOC_P(LDAPMod *); if (mods == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[0] = NULL; } @@ -424,15 +423,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { if (mods[i] == NULL) { mods = SMB_REALLOC_ARRAY (mods, LDAPMod *, i + 2); if (mods == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[i] = SMB_MALLOC_P(LDAPMod); if (mods[i] == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } mods[i]->mod_op = modop; mods[i]->mod_values = NULL; @@ -450,15 +447,13 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { mods[i]->mod_values = SMB_REALLOC_ARRAY(mods[i]->mod_values, char *, j + 2); if (mods[i]->mod_values == NULL) { - smb_panic("smbldap_set_mod: out of memory!\n"); + smb_panic("smbldap_set_mod: out of memory!"); /* notreached. */ - abort(); } if (push_utf8_allocate(&utf8_value, value) == (size_t)-1) { - smb_panic("smbldap_set_mod: String conversion failure!\n"); + smb_panic("smbldap_set_mod: String conversion failure!"); /* notreached. */ - abort(); } mods[i]->mod_values[j] = utf8_value; diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index 0d62360ca6..8159f3a3b5 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -107,9 +107,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, if (sys_setgroups(gid, ngrp_saved, gids_saved) != 0) { /* yikes! */ DEBUG(0,("ERROR: getgrouplist: failed to reset group list!\n")); - smb_panic("getgrouplist: failed to reset group list!\n"); - free(gids_saved); - return -1; + smb_panic("getgrouplist: failed to reset group list!"); } free(gids_saved); diff --git a/source3/lib/util.c b/source3/lib/util.c index 3d72eb5d29..7a927fb3e8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2469,15 +2469,16 @@ int smb_mkstemp(char *name_template) void *smb_xmalloc_array(size_t size, unsigned int count) { void *p; - if (size == 0) - smb_panic("smb_xmalloc_array: called with zero size.\n"); + if (size == 0) { + smb_panic("smb_xmalloc_array: called with zero size"); + } if (count >= MAX_ALLOC_SIZE/size) { - smb_panic("smb_xmalloc: alloc size too large.\n"); + smb_panic("smb_xmalloc_array: alloc size too large"); } if ((p = SMB_MALLOC(size*count)) == NULL) { DEBUG(0, ("smb_xmalloc_array failed to allocate %lu * %lu bytes\n", (unsigned long)size, (unsigned long)count)); - smb_panic("smb_xmalloc_array: malloc fail.\n"); + smb_panic("smb_xmalloc_array: malloc failed"); } return p; } @@ -2517,8 +2518,9 @@ char *smb_xstrdup(const char *s) #endif #define strdup(s) __ERROR_DONT_USE_STRDUP_DIRECTLY #endif - if (!s1) - smb_panic("smb_xstrdup: malloc fail\n"); + if (!s1) { + smb_panic("smb_xstrdup: malloc failed"); + } return s1; } @@ -2547,8 +2549,9 @@ char *smb_xstrndup(const char *s, size_t n) #endif #define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY #endif - if (!s1) - smb_panic("smb_xstrndup: malloc fail\n"); + if (!s1) { + smb_panic("smb_xstrndup: malloc failed"); + } return s1; } @@ -2564,8 +2567,9 @@ char *smb_xstrndup(const char *s, size_t n) VA_COPY(ap2, ap); n = vasprintf(ptr, format, ap2); - if (n == -1 || ! *ptr) + if (n == -1 || ! *ptr) { smb_panic("smb_xvasprintf: out of memory"); + } return n; } @@ -2998,7 +3002,7 @@ void *talloc_check_name_abort(const void *ptr, const char *name) DEBUG(0, ("Talloc type mismatch, expected %s, got %s\n", name, talloc_get_name(ptr))); - smb_panic("aborting"); + smb_panic("talloc type mismatch"); /* Keep the compiler happy */ return NULL; } diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c index 52054ce90a..2c8f2d4a7d 100644 --- a/source3/lib/util_pw.c +++ b/source3/lib/util_pw.c @@ -49,7 +49,7 @@ static void init_pwnam_cache(void) pwnam_cache = TALLOC_ZERO_ARRAY(NULL, struct passwd *, PWNAMCACHE_SIZE); if (pwnam_cache == NULL) { - smb_panic("Could not init pwnam_cache\n"); + smb_panic("Could not init pwnam_cache"); } return; diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 4e0d16c354..6d783198d6 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -802,7 +802,7 @@ int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, if ((res = tdb_store(tdb, key, dbuf, flag)) != 0) { DEBUG(10, ("tdb_store failed\n")); if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed\n"); + smb_panic("Cancelling transaction failed"); } return res; } @@ -831,7 +831,7 @@ int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key) if ((res = tdb_delete(tdb, key)) != 0) { DEBUG(10, ("tdb_delete failed\n")); if (tdb_transaction_cancel(tdb) != 0) { - smb_panic("Cancelling transaction failed\n"); + smb_panic("Cancelling transaction failed"); } return res; } -- cgit