Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Created February 12, 2015 22:29
Show Gist options
  • Save invisiblek/fce1c3dfbb9ab5b79595 to your computer and use it in GitHub Desktop.
Save invisiblek/fce1c3dfbb9ab5b79595 to your computer and use it in GitHub Desktop.
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index e9d13aa..82c4e99 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -270,6 +270,10 @@ char *get_fstype_from_devname(const char *device)
{
#if ENABLE_FEATURE_BLKID_TYPE
struct uuidCache_s *uc;
+ struct stat *statbuf;
+
+ if (stat(device, statbuf) < 0 || !S_ISBLK(statbuf->st_mode))
+ return NULL;
add_to_uuid_cache(device);
uc = uuidcache_init(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment