From d1db41c05971b14b16a4dd27df2c5260fcaa5d7f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 21 Oct 2007 17:05:34 +0200 Subject: [PATCH] Don't segfault if locking.tdb can't be opened Thanks to Steve Langasek (This used to be commit 67328bd27b1e881a4bcdd5160133afa9a267eaac) --- source3/utils/status.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source3/utils/status.c b/source3/utils/status.c index 8bf1de0e617..9a4b3a48351 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -426,6 +426,19 @@ static int traverse_sessionid(struct db_record *db, void *state) if ( show_locks ) { int result; + struct db_context *db; + db = db_open(NULL, lock_path("locking.tdb"), 0, + TDB_DEFAULT, O_RDONLY, 0); + + if (!db) { + d_printf("%s not initialised\n", + lock_path("locking.tdb")); + d_printf("This is normal if an SMB client has never " + "connected to your server.\n"); + exit(0); + } else { + TALLOC_FREE(db); + } if (!locking_init(1)) { d_printf("Can't initialise locking module - exiting\n"); -- 2.34.1