From 762821c656f018b9f03d131cdaee08b011d0c399 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 18 Jul 2007 13:06:03 -0700 Subject: [PATCH] Extract major/minor components of device numbers. I hope these are the right macros and include files to use... --- scandir.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scandir.cc b/scandir.cc index 89bdaab..5b3caaa 100644 --- a/scandir.cc +++ b/scandir.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -351,7 +352,8 @@ void scanfile(const string& path, bool include) case S_IFBLK: case S_IFCHR: inode_type = ((stat_buf.st_mode & S_IFMT) == S_IFBLK) ? 'b' : 'c'; - file_info["device"] = encode_int(stat_buf.st_rdev); + file_info["device"] = encode_int(major(stat_buf.st_rdev)) + + "/" + encode_int(minor(stat_buf.st_rdev)); break; case S_IFLNK: inode_type = 'l'; -- 2.20.1