cluster: RHEL64 - libgfs2: check return code of rename

Andrew Price andyp at fedoraproject.org
Thu Aug 29 10:24:58 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=cf62f1ff9ec1a9d3aae6a9c473c3e002467b220a
Commit:        cf62f1ff9ec1a9d3aae6a9c473c3e002467b220a
Parent:        8a67d7986d5ee4de27d89200cf1195cd427bb5f0
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Aug 15 07:34:26 2013 -0500
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Thu Aug 29 11:19:47 2013 +0100

libgfs2: check return code of rename

This patch adds code to check the return code of 'rename' while
trying to update /etc/mtab.

rhbz#1001504
---
 gfs2/libgfs2/misc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index a6738b6..f7fab7e 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -246,7 +246,8 @@ static void remove_mtab_entry(struct gfs2_sbd *sdp)
 	endmntent(mtab);
 	fclose(mtabnew);
 	close(fd);
-	rename(mtab_tmpfn, "/etc/mtab");
+	if (rename(mtab_tmpfn, "/etc/mtab"))
+		fprintf(stderr, "Unable to add mount entry to mtab.\n");
 }
 
 void cleanup_metafs(struct gfs2_sbd *sdp)


More information about the cluster-commits mailing list