style fixes
last xcalloc replaced by xzalloc
This commit is contained in:
@ -17,12 +17,13 @@ char *find_block_device(char *path)
|
||||
dev_t dev;
|
||||
char *retpath=NULL;
|
||||
|
||||
if(stat(path, &st) || !(dir = opendir("/dev"))) return NULL;
|
||||
if (stat(path, &st) || !(dir = opendir("/dev")))
|
||||
return NULL;
|
||||
dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev;
|
||||
while((entry = readdir(dir)) != NULL) {
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
char devpath[PATH_MAX];
|
||||
sprintf(devpath,"/dev/%s", entry->d_name);
|
||||
if(!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) {
|
||||
if (!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) {
|
||||
retpath = xstrdup(devpath);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user