gfs2-utils: RHEL7 - fsck.gfs2: Simplify bad_journalname

Andrew Price andyp at fedoraproject.org
Tue Apr 7 21:23:52 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=30d1c654b637f38f168e13a489a3c9f110fca63e
Commit:        30d1c654b637f38f168e13a489a3c9f110fca63e
Parent:        1be8d75fd107390cb422dabf25062f9f7423c25c
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Tue Jan 27 12:05:07 2015 +0000
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100

fsck.gfs2: Simplify bad_journalname

Remove the need for a temporary string and strncpy call by passing the
length of the string to printf.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/fsck/initialize.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 1ab078b..c052205 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -1513,14 +1513,10 @@ static int init_rindex(struct gfs2_sbd *sdp)
 
 static void bad_journalname(const char *filename, int len)
 {
-	char tmp_name[64];
-
 	if (len >= 64)
 		len = 63;
-	strncpy(tmp_name, filename, len);
-	tmp_name[len] = '\0';
-	log_debug(_("Journal index entry '%s' has an invalid filename.\n"),
-		  tmp_name);
+	log_debug(_("Journal index entry '%.*s' has an invalid filename.\n"),
+	          len, filename);
 }
 
 /**


More information about the cluster-commits mailing list