git » libjio » commit a5ee5df

Transactions ID are always unsigned; however get_jtfile() takes them as signed. Fix it.

author Alberto Bertogli
2004-10-04 15:27:13 UTC
committer Alberto Bertogli
2007-07-15 13:25:37 UTC
parent a2cc3f4ed9df15ea9d15884bcf92917d6a931e85

Transactions ID are always unsigned; however get_jtfile() takes them as signed. Fix it.

Transactions ID are always unsigned; however get_jtfile() takes them as
signed. Fix it.

common.c +2 -2
common.h +1 -1

diff --git a/common.c b/common.c
index 01119ef..a2e9bf0 100644
--- a/common.c
+++ b/common.c
@@ -126,7 +126,7 @@ int get_jdir(const char *filename, char *jdir)
 }
 
 /* build the filename of a given transaction */
-int get_jtfile(const char *filename, int tid, char *jtfile)
+int get_jtfile(const char *filename, unsigned int tid, char *jtfile)
 {
 	char *base, *baset;
 	char *dir, *dirt;
@@ -141,7 +141,7 @@ int get_jtfile(const char *filename, int tid, char *jtfile)
 		return 0;
 	dir = dirname(dirt);
 
-	snprintf(jtfile, PATH_MAX, "%s/.%s.jio/%d", dir, base, tid);
+	snprintf(jtfile, PATH_MAX, "%s/.%s.jio/%u", dir, base, tid);
 
 	free(baset);
 	free(dirt);
diff --git a/common.h b/common.h
index 1b7bada..586ceb5 100644
--- a/common.h
+++ b/common.h
@@ -30,7 +30,7 @@ off_t plockf(int fd, int cmd, off_t offset, off_t len);
 ssize_t spread(int fd, void *buf, size_t count, off_t offset);
 ssize_t spwrite(int fd, const void *buf, size_t count, off_t offset);
 int get_jdir(const char *filename, char *jdir);
-int get_jtfile(const char *filename, int tid, char *jtfile);
+int get_jtfile(const char *filename, unsigned int tid, char *jtfile);
 
 int checksum(int fd, size_t len, uint32_t *csum);
 uint32_t checksum_map(uint8_t *map, size_t count);