[OpenWrt-Devel] [PATCH fstools] libfstools: fix find_mount to return device path

Rafał Miłecki zajec5 at gmail.com
Tue Dec 23 06:56:52 EST 2014


So far we were returning mount point which doesn't make sense for a
function that already takes mount point as an argument.

Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
 libfstools/find.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libfstools/find.c b/libfstools/find.c
index b50b633..4c69d73 100644
--- a/libfstools/find.c
+++ b/libfstools/find.c
@@ -36,6 +36,9 @@ find_overlay_mount(char *overlay)
 	return ret;
 }
 
+/*
+ * Find path of a device mounted to the given point.
+ */
 char*
 find_mount(char *mp)
 {
@@ -53,6 +56,7 @@ find_mount(char *mp)
 			fclose(fp);
 			return NULL;
 		}
+		*t = '\0';
 		t++;
 		s = strstr(t, " ");
 		if (!s) {
@@ -63,7 +67,7 @@ find_mount(char *mp)
 
 		if (!strcmp(t, mp)) {
 			fclose(fp);
-			return t;
+			return line;
 		}
 	}
 
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list