#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <unistd.h>
#include <string>
#include <vector>
-#include "format.h"
#include "localdb.h"
#include "store.h"
#include "sha1.h"
#include "statcache.h"
+#include "util.h"
using std::list;
using std::string;
case S_IFSOCK:
inode_type = 's';
break;
- case S_IFCHR:
- inode_type = 'c';
- break;
case S_IFBLK:
- inode_type = 'b';
+ case S_IFCHR:
+ inode_type = ((stat_buf.st_mode & S_IFMT) == S_IFBLK) ? 'b' : 'c';
+ file_info["device"] = encode_int(major(stat_buf.st_rdev))
+ + "/" + encode_int(minor(stat_buf.st_rdev));
break;
case S_IFLNK:
inode_type = 'l';