Browse Source

tdb: fix ecode setting on nonblocking brlock

This bug was introduced in "Wean off TDB_ERRCODE.".
Rusty Russell 16 years ago
parent
commit
e9cc05b230
1 changed files with 1 additions and 2 deletions
  1. 1 2
      ccan/tdb/lock.c

+ 1 - 2
ccan/tdb/lock.c

@@ -158,12 +158,11 @@ int tdb_brlock(struct tdb_context *tdb,
 	} while (ret == -1 && errno == EINTR);
 	} while (ret == -1 && errno == EINTR);
 
 
 	if (ret == -1) {
 	if (ret == -1) {
+		tdb->ecode = TDB_ERR_LOCK;
 		/* Generic lock error. errno set by fcntl.
 		/* Generic lock error. errno set by fcntl.
 		 * EAGAIN is an expected return from non-blocking
 		 * EAGAIN is an expected return from non-blocking
 		 * locks. */
 		 * locks. */
 		if (!(flags & TDB_LOCK_PROBE) && errno != EAGAIN) {
 		if (!(flags & TDB_LOCK_PROBE) && errno != EAGAIN) {
-			/* Ensure error code is set for log fun to examine. */
-			tdb->ecode = TDB_ERR_LOCK;
 			TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d flags=%d len=%d\n", 
 			TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d flags=%d len=%d\n", 
 				 tdb->fd, offset, rw_type, flags, (int)len));
 				 tdb->fd, offset, rw_type, flags, (int)len));
 		}
 		}