author | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-02-22 06:35:16 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2009-02-22 06:45:19 UTC |
parent | 0cf5dbd40ff3a579208e47eb3260ebf54dfd996e |
check.c | +1 | -4 |
common.c | +3 | -3 |
common.h | +1 | -1 |
trans.c | +1 | -2 |
diff --git a/check.c b/check.c index 4c3fc6b..b5b095c 100644 --- a/check.c +++ b/check.c @@ -227,10 +227,7 @@ int jfsck(const char *name, const char *jdir, struct jfsck_result *res) * really looping in order (recovering transaction in a * different order as they were applied means instant * corruption) */ - if (!get_jtfile(&fs, i, tname)) { - ret = J_ENOMEM; - goto exit; - } + get_jtfile(&fs, i, tname); tfd = open(tname, O_RDWR | O_SYNC, 0600); if (tfd < 0) { res->invalid++; diff --git a/common.c b/common.c index 0c77975..5f58ca3 100644 --- a/common.c +++ b/common.c @@ -126,11 +126,11 @@ int get_jdir(const char *filename, char *jdir) return 1; } -/* build the filename of a given transaction */ -int get_jtfile(struct jfs *fs, unsigned int tid, char *jtfile) +/* build the filename of a given transaction; assumes jtfile can hold at least + * PATH_MAX bytes */ +void get_jtfile(struct jfs *fs, unsigned int tid, char *jtfile) { snprintf(jtfile, PATH_MAX, "%s/%u", fs->jdir, tid); - return 1; } diff --git a/common.h b/common.h index b3f093f..b25ec26 100644 --- a/common.h +++ b/common.h @@ -33,7 +33,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(struct jfs *fs, unsigned int tid, char *jtfile); +void get_jtfile(struct jfs *fs, 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); diff --git a/trans.c b/trans.c index df340d6..a39e63e 100644 --- a/trans.c +++ b/trans.c @@ -236,8 +236,7 @@ ssize_t jtrans_commit(struct jtrans *ts) goto exit; /* open the transaction file */ - if (!get_jtfile(ts->fs, id, name)) - goto exit; + get_jtfile(ts->fs, id, name); fd = open(name, O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd < 0) goto exit;