RIP BOOL. Convert BOOL -> bool. I found a few interesting
[nivanova/samba-autobuild/.git] / source3 / printing / printing_db.c
index adea10dfa691b5277152a65f1e63ad1f5a5e3677..db736765fca8e9397354be8e5b4ebb2ce7893b2e 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -35,7 +34,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
        struct tdb_print_db *p = NULL, *last_entry = NULL;
        int num_open = 0;
        pstring printdb_path;
-       BOOL done_become_root = False;
+       bool done_become_root = False;
 
        SMB_ASSERT(printername != NULL);
 
@@ -55,7 +54,9 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
        /* Not found. */
        if (num_open >= MAX_PRINT_DBS_OPEN) {
                /* Try and recycle the last entry. */
-               DLIST_PROMOTE(print_db_head, last_entry);
+               if (print_db_head && last_entry) {
+                       DLIST_PROMOTE(print_db_head, last_entry);
+               }
 
                for (p = print_db_head; p; p = p->next) {
                        if (p->ref_count)
@@ -72,7 +73,7 @@ struct tdb_print_db *get_print_db_byname(const char *printername)
                        memset(p->printer_name, '\0', sizeof(p->printer_name));
                        break;
                }
-               if (p) {
+               if (p && print_db_head) {
                        DLIST_PROMOTE(print_db_head, p);
                        p = print_db_head;
                }
@@ -151,7 +152,7 @@ void close_all_print_db(void)
  messages. data needs freeing on exit.
 ****************************************************************************/
 
-TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, BOOL cleanlist)
+TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist)
 {
        TDB_DATA data;
        size_t i;