changeset 4648:93a6d2194c5d HEAD

Handle ENOENT silently and return 0.
author Timo Sirainen <tss@iki.fi>
date Wed, 11 Oct 2006 13:33:20 +0300
parents 5f467dc79a19
children a3d6a3462745
files src/lib/mountpoint.c src/lib/mountpoint.h
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/mountpoint.c	Mon Oct 09 20:26:01 2006 +0300
+++ b/src/lib/mountpoint.c	Wed Oct 11 13:33:20 2006 +0300
@@ -44,6 +44,9 @@
 
 	memset(point_r, 0, sizeof(*point_r));
 	if (statfs(path, &buf) < 0) {
+		if (errno == ENOENT)
+			return 0;
+
 		i_error("statfs(%s) failed: %m", path);
 		return -1;
 	}
@@ -67,6 +70,9 @@
 
 	memset(point_r, 0, sizeof(*point_r));
 	if (stat(path, &st) < 0) {
+		if (errno == ENOENT)
+			return 0;
+
 		i_error("stat(%s) failed: %m", path);
 		return -1;
 	}
--- a/src/lib/mountpoint.h	Mon Oct 09 20:26:01 2006 +0300
+++ b/src/lib/mountpoint.h	Wed Oct 11 13:33:20 2006 +0300
@@ -8,7 +8,8 @@
 	unsigned int block_size;
 };
 
-/* Returns 1 = found, 0 = not found, -1 = error */
+/* Returns 1 = found, 0 = not found (from mount tabs, or the path itself),
+   -1 = error */
 int mountpoint_get(const char *path, pool_t pool, struct mountpoint *point_r);
 
 #endif