summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2017-05-01 12:05:19 +0300
committerRobert Mustacchi <rm@joyent.com>2017-05-08 16:27:57 +0000
commitbc30fb4ce8dc6097bcc9d02b809aa94feef79bfa (patch)
treebe7c6906350cb278201870d5ff8a6b23fe0259d0
parent132157d7fb25c120ae1deca2a65fa7c78e8fcfd0 (diff)
downloadillumos-joyent-bc30fb4ce8dc6097bcc9d02b809aa94feef79bfa.tar.gz
8136 libnisdb: NULL pointer is used in wrong context
Reviewed by: Yuri Pankov <yuri.pankov@gmail.com> Reviewed by: Marcel Telka <marcel@telka.sk> Reviewed by: Igor Kozhukhov <igor@dilos.org> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/lib/libnisdb/db.cc4
-rw-r--r--usr/src/lib/libnisdb/db_dictionary.cc2
-rw-r--r--usr/src/lib/libnisdb/db_log_c.x4
-rw-r--r--usr/src/lib/libnisdb/db_table.cc18
4 files changed, 12 insertions, 16 deletions
diff --git a/usr/src/lib/libnisdb/db.cc b/usr/src/lib/libnisdb/db.cc
index 61e45792fe..ef3def0f2e 100644
--- a/usr/src/lib/libnisdb/db.cc
+++ b/usr/src/lib/libnisdb/db.cc
@@ -26,8 +26,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#ifdef TDRPC
@@ -487,7 +485,7 @@ db::open_log(bool_t copylog)
logfile->copylog = copylog;
- if ((logfile->open()) == NULL){
+ if ((logfile->open()) == FALSE){
WARNING_M("db::open_log: could not open log file: ");
delete logfile;
logfile = NULL;
diff --git a/usr/src/lib/libnisdb/db_dictionary.cc b/usr/src/lib/libnisdb/db_dictionary.cc
index a642bb3f09..2b44a6a126 100644
--- a/usr/src/lib/libnisdb/db_dictionary.cc
+++ b/usr/src/lib/libnisdb/db_dictionary.cc
@@ -1402,7 +1402,7 @@ db_dictionary::open_log()
return (0);
}
- if ((logfile->open()) == NULL) {
+ if ((logfile->open()) == FALSE) {
WARNING_M("db_dictionary::open_log: could not open log file: ");
delete logfile;
logfile = NULL;
diff --git a/usr/src/lib/libnisdb/db_log_c.x b/usr/src/lib/libnisdb/db_log_c.x
index 96944ea165..1d9708eecf 100644
--- a/usr/src/lib/libnisdb/db_log_c.x
+++ b/usr/src/lib/libnisdb/db_log_c.x
@@ -26,8 +26,6 @@
* Use is subject to license terms.
*/
-%#pragma ident "%Z%%M% %I% %E% SMI"
-
#if RPC_HDR
%#ifndef _DB_LOG_H
%#define _DB_LOG_H
@@ -100,7 +98,7 @@
%/* bool_t dump( pptr ) {return TRUE;}*/ // does nothing.
%
%/* Open log file */
-% int open(void);
+% bool_t open(void);
%/* Close log file */
% int close();
%/* Do we need to copy the log file */
diff --git a/usr/src/lib/libnisdb/db_table.cc b/usr/src/lib/libnisdb/db_table.cc
index e68ea87d9a..c7cbfafcaf 100644
--- a/usr/src/lib/libnisdb/db_table.cc
+++ b/usr/src/lib/libnisdb/db_table.cc
@@ -145,14 +145,14 @@ db_free_list::reset()
WRITEUNLOCKV(this, "wu db_free_list::reset");
}
-/* Returns the location of a free entry, or NULL, if there aren't any. */
+/* Returns the location of a free entry, or 0, if there aren't any. */
entryp
db_free_list::pop()
{
- WRITELOCK(this, NULL, "w db_free_list::pop");
+ WRITELOCK(this, 0, "w db_free_list::pop");
if (head == NULL) {
- WRITEUNLOCK(this, NULL, "wu db_free_list::pop");
- return (NULL);
+ WRITEUNLOCK(this, 0, "wu db_free_list::pop");
+ return (0);
}
db_free_entry* old_head = head;
entryp found = head->where;
@@ -507,7 +507,7 @@ db_table::first_entry(entryp * where)
{
ASSERTRHELD(table);
if (count == 0 || tab == NULL) { /* empty table */
- *where = NULL;
+ *where = 0;
return (NULL);
} else {
entryp i;
@@ -519,7 +519,7 @@ db_table::first_entry(entryp * where)
}
}
}
- *where = NULL;
+ *where = 0;
return (NULL);
}
@@ -541,7 +541,7 @@ db_table::next_entry(entryp prev, entryp* newentry)
return (tab[i]);
}
}
- *newentry = NULL;
+ *newentry = 0;
return (NULL);
}
@@ -662,7 +662,7 @@ db_table::add_entry(entry_object *obj, int initialLoad) {
*/
ASSERTWHELD(table);
entryp where = freelist.pop();
- if (where == NULL) { /* empty freelist */
+ if (where == 0) { /* empty freelist */
if (last_used >= (table_size-1)) /* full (> is for 0) */
grow();
where = ++last_used;
@@ -676,7 +676,7 @@ db_table::add_entry(entry_object *obj, int initialLoad) {
tab[where] = new_entry(obj);
return (where);
} else {
- return (NULL);
+ return (0);
}
}