randomconfig fixes
[oweals/busybox.git] / libbb / ubi.c
index 7d3b2952d082a67b0f6ca212129c47c2fd599ff8..a90016acf4a80685ed71e617ab346cec50da8d2d 100644 (file)
 
 unsigned FAST_FUNC ubi_devnum_from_devname(const char *str)
 {
-        unsigned ubi_devnum;
+       unsigned ubi_devnum;
 
-        if (sscanf(str, "/dev/ubi%u", &ubi_devnum) != 1)
-                bb_error_msg_and_die("not an UBI device: '%s'", str);
+       if (sscanf(str, "/dev/ubi%u", &ubi_devnum) != 1)
+               bb_error_msg_and_die("not an UBI device: '%s'", str);
        return ubi_devnum;
 }
 
-int FAST_FUNC get_volid_by_name(unsigned ubi_devnum, const char *vol_name)
+int FAST_FUNC ubi_get_volid_by_name(unsigned ubi_devnum, const char *vol_name)
 {
        unsigned i;
 
@@ -35,6 +35,7 @@ int FAST_FUNC get_volid_by_name(unsigned ubi_devnum, const char *vol_name)
                if (open_read_close(fname, buf, sizeof(buf)) <= 0)
                        continue;
 
+               buf[UBI_MAX_VOLUME_NAME] = '\0';
                strchrnul(buf, '\n')[0] = '\0';
                if (strcmp(vol_name, buf) == 0)
                        return i;