File mount.cifs-handle-errors-in-del_mtab.patch of Package cifs-utils.openSUSE_12.1_Update

commit 92be8b6775958814d39fb19247ff85947a2e4f9e
Author: Jeff Layton <jlayton@samba.org>
Date:   Mon Jan 16 13:22:28 2012 -0500

   mount.cifs: handle errors from rename() in del_mtab

The new del_mtab code ignored errors from rename(). Make it handle that
error as well like it does other errors.

Fixes bnc#747906.

Cc: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
---
 mount.cifs.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Index: mount.cifs.c
===================================================================
--- mount.cifs.c.orig
+++ mount.cifs.c
@@ -1592,7 +1592,11 @@ del_mtab(char *mountpoint)
 
 	endmntent(mntmtab);
 
-	rename(mtabtmpfile, MOUNTED);
+	if (rename(mtabtmpfile, MOUNTED)) {
+		fprintf(stderr, "del_mtab: error %d when renaming mtab in place\n", errno);
+		rc = EX_FILEIO;
+		goto del_mtab_error;
+	}
 
 del_mtab_exit:
 	unlock_mtab();
openSUSE Build Service is sponsored by