[dovecot-cvs] dovecot/src/lib mountpoint.c,1.3,1.4

cras at dovecot.org cras at dovecot.org
Fri Apr 14 14:28:23 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv24877/lib

Modified Files:
	mountpoint.c 
Log Message:
Clear mountpoint struct even in error cases.



Index: mountpoint.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mountpoint.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mountpoint.c	14 Apr 2006 11:26:37 -0000	1.3
+++ mountpoint.c	14 Apr 2006 11:28:21 -0000	1.4
@@ -35,6 +35,7 @@
 int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r)
 {
 #ifdef MOUNTPOINT_UNKNOWN
+	memset(point_r, 0, sizeof(*point_r));
 	errno = ENOSYS;
 	return -1;
 #elif defined (HAVE_STATFS_MNTFROMNAME)
@@ -64,6 +65,7 @@
 	unsigned int block_size;
 	FILE *f;
 
+	memset(point_r, 0, sizeof(*point_r));
 	if (stat(path, &st) < 0) {
 		i_error("stat(%s) failed: %m", path);
 		return -1;
@@ -116,12 +118,10 @@
 	if (device_path == NULL)
 		return 0;
 
-	memset(point_r, 0, sizeof(*point_r));
 	point_r->device_path = p_strdup(pool, device_path);
 	point_r->mount_path = p_strdup(pool, mount_path);
 	point_r->type = p_strdup(pool, type);
 	point_r->block_size = block_size;
-
 	return 1;
 #endif
 }



More information about the dovecot-cvs mailing list