

Transaction IDs are unsigned and always greater than 0.

There was a bug that might cause it to be negative because the mmap was casted
to a signed integer and not to an unsigned one.

Besides, start from 0 instead of 1; there's no reason to begin with 1.

Note that the number stored in the lockfile is the maximum number in use, 0
meaning there are no transactions in course. But for no reason a transaction
can have a tid 0.


---

 cur-root/libjio.h |    2 +-
 cur-root/trans.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN libjio.h~fix_tid_handling libjio.h
--- cur/libjio.h~fix_tid_handling	2004-07-22 10:59:45.579143056 -0300
+++ cur-root/libjio.h	2004-07-22 10:59:56.945415120 -0300
@@ -26,7 +26,7 @@ struct jfs {
 	char *name;		/* and its name */
 	int jdirfd;		/* journal directory file descriptor */
 	int jfd;		/* journal's lock file descriptor */
-	int *jmap;		/* journal's lock file mmap area */
+	unsigned int *jmap;	/* journal's lock file mmap area */
 	int flags;		/* journal flags */
 	struct jlinger *ltrans;	/* lingered transactions */
 	pthread_mutex_t lock;	/* a soft lock used in some operations */
diff -puN trans.c~fix_tid_handling trans.c
--- cur/trans.c~fix_tid_handling	2004-07-22 11:00:12.744013368 -0300
+++ cur-root/trans.c	2004-07-22 11:01:32.426899728 -0300
@@ -555,7 +555,7 @@ int jopen(struct jfs *fs, const char *na
 	plockf(jfd, F_LOCKW, 0, 0);
 	lstat(jlockfile, &sinfo);
 	if (sinfo.st_size != sizeof(unsigned int)) {
-		t = 1;
+		t = 0;
 		rv = spwrite(jfd, &t, sizeof(t), 0);
 		if (rv != sizeof(t)) {
 			plockf(jfd, F_UNLOCK, 0, 0);
_
