+
+ // In case root is mounted from snapshot, _fsi_get_device_path will return NULL as the device name does not comply to
+ // /dev/diskAAsBB, but in the format of snap@/dev/diskAAsBB, in that case f_mntfromname has the correct device name, so return it
+ if (root_spec == NULL) {
+ const char *mntfromname = rootfsinfo.f_mntfromname;
+ size_t len = sizeof(rootfsinfo.f_mntfromname);
+ const char *p;
+ while ((p = strnstr(mntfromname, "@", len))) {
+ len -= p + 1 - mntfromname;
+ mntfromname = p + 1;
+ }
+ root_spec = strndup(mntfromname, len);
+ }
+