s3:locking:posix: remove uses of SMB_ASSERT() from get_windows_lock_ref_count()
authorMichael Adam <obnox@samba.org>
Thu, 10 Nov 2011 22:11:54 +0000 (23:11 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 25 Nov 2011 13:59:53 +0000 (14:59 +0100)
SMB_ASSERT is useless, since in non-developer build it does not actually
fail after the log message, but usual flow just continues.

Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Nov 25 14:59:53 CET 2011 on sn-devel-104

source3/locking/posix.c

index 3a8b1635d8c887b6b7eaa3f43dba796dea0db576..0ff2395d60ccc2935f52259f67f8f74507be0f24 100644 (file)
@@ -517,9 +517,20 @@ static int get_windows_lock_ref_count(files_struct *fsp)
                goto done;
        }
 
-       SMB_ASSERT(NT_STATUS_IS_OK(status));
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0, ("get_windows_lock_ref_count: Error fetching "
+                         "lock ref count for file %s: %s\n",
+                         fsp_str_dbg(fsp), nt_errstr(status)));
+               goto done;
+       }
 
-       SMB_ASSERT(dbuf.dsize == sizeof(lock_ref_count));
+       if (dbuf.dsize != sizeof(lock_ref_count)) {
+               DEBUG(0, ("get_windows_lock_ref_count: invalid entry "
+                         "in lock ref count record for file %s: "
+                         "(invalid data size %u)\n",
+                         fsp_str_dbg(fsp), (unsigned int)dbuf.dsize));
+               goto done;
+       }
 
        memcpy(&lock_ref_count, dbuf.dptr, sizeof(lock_ref_count));
        TALLOC_FREE(dbuf.dptr);