Skip to content

Commit

Permalink
ncurses: dont rely on mnttype for partitioned blockdev (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Sep 19, 2019
1 parent 8403923 commit 5fc4ba6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/growlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ typedef struct device {
char *sched; // I/O scheduler (can be NULL)
unsigned roflag; // Read-only flag (hdparm -r, blockdev --getro)
int slave; // Number of owning devices
union {
union { // keyed off value of "layout" enum below
struct {
transport_e transport;
unsigned realdev: 1; // Is itself a real block device
Expand Down
6 changes: 5 additions & 1 deletion src/ncurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,11 @@ print_blockbar(WINDOW *w,const blockobj *bo,int y,int sx,int ex,int selected){

zs = d->mntsize ? d->mntsize :
(last_usable_sector(d) - first_usable_sector(d) + 1) * bo->d->logsec;
if(d->mnttype){
// Sometimes, a partitioned block device will be given a mnttype by
// libblkid (usually due to a filesystem signature in unpartitioned
// space at the beginning). In that case, don't try to print based off
// the bogon block device mnttype.
if(d->mnttype && (d->layout != LAYOUT_NONE || !d->blkdev.pttable)){
int co = mnttype_aggregablep(d->mnttype) ?
COLOR_PAIR(PART_COLOR0) : COLOR_PAIR(FS_COLOR);

Expand Down

0 comments on commit 5fc4ba6

Please sign in to comment.