git » libjio » commit 3a35fad

libjio: Minor aesthetic improvements to trans.c

author Alberto Bertogli
2009-08-02 00:54:45 UTC
committer Alberto Bertogli
2009-08-02 01:16:44 UTC
parent ea2357462f298de0708c9e3a2ec9a87323efcacd

libjio: Minor aesthetic improvements to trans.c

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

libjio/trans.c +7 -6

diff --git a/libjio/trans.c b/libjio/trans.c
index a379943..2d196c7 100644
--- a/libjio/trans.c
+++ b/libjio/trans.c
@@ -559,7 +559,7 @@ struct jfs *jopen(const char *name, int flags, int mode, unsigned int jflags)
 	if (fs->jdirfd < 0)
 		goto error_exit;
 
-	snprintf(jlockfile, PATH_MAX, "%s/%s", jdir, "lock");
+	snprintf(jlockfile, PATH_MAX, "%s/lock", jdir);
 	jfd = open(jlockfile, O_RDWR | O_CREAT, 0600);
 	if (jfd < 0)
 		goto error_exit;
@@ -637,13 +637,13 @@ int jmove_journal(struct jfs *fs, const char *newpath)
 
 	/* we try to be sure that all lingering transactions have been
 	 * applied, so when we try to remove the journal directory, only the
-	 * lockfile is there; however, we do this just to be nice, but the
-	 * caller must be sure there are no in-flight transactions or any
-	 * other kind of operation around when he calls this function */
+	 * lockfile is there; however, we do this just to be nice, the caller
+	 * must be sure there are no in-flight transactions or any other kind
+	 * of operation around when he calls this function */
 	jsync(fs);
 
 	oldpath = fs->jdir;
-	snprintf(oldjlockfile, PATH_MAX, "%s/%s", fs->jdir, "lock");
+	snprintf(oldjlockfile, PATH_MAX, "%s/lock", fs->jdir);
 
 	fs->jdir = (char *) malloc(strlen(newpath + 1));
 	if (fs->jdir == NULL)
@@ -660,7 +660,7 @@ int jmove_journal(struct jfs *fs, const char *newpath)
 		if (fs->jdirfd < 0)
 			goto exit;
 
-		snprintf(jlockfile, PATH_MAX, "%s/%s", newpath, "lock");
+		snprintf(jlockfile, PATH_MAX, "%s/lock", newpath);
 		ret = rename(oldjlockfile, jlockfile);
 		if (ret < 0)
 			goto exit;
@@ -710,6 +710,7 @@ int jclose(struct jfs *fs)
 		free(fs->name);
 	if (fs->jdir)
 		free(fs->jdir);
+
 	pthread_mutex_destroy(&(fs->lock));
 
 	free(fs);