mountstats: Fix spurious I/O errors

When running mountstats under "watch," occassionally the output
shows "close failed in file object desctructor: sys.excepthook is
missing" and the data display is messed up. This seems to be a
common problem when Python script output is piped to another
program.

Ensure stdout/stderr is completely flushed before mountstats exits,
and add an IOError exception handler to catch these exceptions
gracefully.

Solution suggested by: http://bugs.python.org/issue11380

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
exportfs: Do not fail on empty exports file.

Commit 076dd80 introduced a regression that causes
exportfs to fail when there is an empty /etc/exports
file. A empty /etc/exports file is valid and should
not cause exportfs to fail.

Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
nfsdcltrack: use sqlite3_close instead of sqlite3_close_v2

sqlite3_close_v2 wasn't added until v3.7.14 of libsqlite3 so this causes
the build to fail vs. very old sqlite3 libs. Also, Chuck points out that
the documentation says that sqlite3_close_v2 is intended for use with
host languages that are garbage collected, and C isn't.

In practice, we shouldn't ever see sqlite3_close return SQLITE_BUSY here
anyway since the program is single-threaded, so sqlite3_close should be
fine.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
nfsdcltrack: use sqlite3_errmsg instead of sqlite3_errstr

sqlite3_errstr was only added in v3.7.15 of libsqlite3, which makes it
difficult to build against earlier releases. Switch the code over to
use sqlite3_errmsg instead.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Steve Dickson <steved@redhat.com>