libfstools: convert to ulog() api
[project/fstools.git] / libfstools / find.c
index b50b633..0440052 100644 (file)
@@ -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;
                }
        }
 
@@ -100,7 +104,7 @@ find_mount_point(char *block, int mtd_only)
                            strncmp(t, "jffs2", 5) &&
                            strncmp(t, "ubifs", 5)) {
                                fclose(fp);
-                               fprintf(stderr, "block is mounted with wrong fs\n");
+                               ULOG_ERR("block is mounted with wrong fs\n");
                                return NULL;
                        }
                        point = p;
@@ -122,7 +126,7 @@ find_filesystem(char *fs)
        int ret = -1;
 
        if (!fp) {
-               fprintf(stderr, "opening /proc/filesystems failed: %s\n", strerror(errno));
+               ULOG_ERR("opening /proc/filesystems failed: %s\n", strerror(errno));
                goto out;
        }