]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfsdcltrack: remove pointless sqlite_topdir variable
authorJeff Layton <jlayton@redhat.com>
Thu, 8 Nov 2012 19:39:28 +0000 (14:39 -0500)
committerSteve Dickson <steved@redhat.com>
Sun, 11 Nov 2012 23:01:23 +0000 (18:01 -0500)
This is holdover from an earlier version of the code and doesn't really
provide any benefit. Also, mark the topdir and dirname arguments const
since they should never be changed.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/nfsdcltrack/nfsdcld
utils/nfsdcltrack/sqlite.c
utils/nfsdcltrack/sqlite.h

index 47801fc9db23a39627dde63a779da352864e3256..651b0c35306120de549505a083ea8d50ffab7b48 100755 (executable)
Binary files a/utils/nfsdcltrack/nfsdcld and b/utils/nfsdcltrack/nfsdcld differ
index fc882c6f40ce8eb9d2966dc1c6503a3ee7e3b7d4..c19af7e19e3dd8a3514d0c594fea7fcaf4a3ef08 100644 (file)
@@ -61,9 +61,6 @@
 
 /* global variables */
 
 
 /* global variables */
 
-/* top level DB directory */
-static char *sqlite_topdir;
-
 /* reusable pathname and sql command buffer */
 static char buf[PATH_MAX];
 
 /* reusable pathname and sql command buffer */
 static char buf[PATH_MAX];
 
@@ -74,7 +71,7 @@ static sqlite3 *dbh;
 
 /* make a directory, ignoring EEXIST errors unless it's not a directory */
 static int
 
 /* make a directory, ignoring EEXIST errors unless it's not a directory */
 static int
-mkdir_if_not_exist(char *dirname)
+mkdir_if_not_exist(const char *dirname)
 {
        int ret;
        struct stat statbuf;
 {
        int ret;
        struct stat statbuf;
@@ -102,19 +99,17 @@ mkdir_if_not_exist(char *dirname)
  * the "clients" table.
  */
 int
  * the "clients" table.
  */
 int
-sqlite_maindb_init(char *topdir)
+sqlite_maindb_init(const char *topdir)
 {
        int ret;
        char *err = NULL;
        sqlite3_stmt *stmt = NULL;
 
 {
        int ret;
        char *err = NULL;
        sqlite3_stmt *stmt = NULL;
 
-       sqlite_topdir = topdir;
-
-       ret = mkdir_if_not_exist(sqlite_topdir);
+       ret = mkdir_if_not_exist(topdir);
        if (ret)
                return ret;
 
        if (ret)
                return ret;
 
-       ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", sqlite_topdir);
+       ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", topdir);
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
 
index c85e7d683c0a2c763a1efe872c5e41902fd9c7b8..874894891420b1a631bee8fbd69c88af7d75966b 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
 
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
 
-int sqlite_maindb_init(char *topdir);
+int sqlite_maindb_init(const char *topdir);
 int sqlite_insert_client(const unsigned char *clname, const size_t namelen);
 int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
 int sqlite_check_client(const unsigned char *clname, const size_t namelen);
 int sqlite_insert_client(const unsigned char *clname, const size_t namelen);
 int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
 int sqlite_check_client(const unsigned char *clname, const size_t namelen);