Ticket #1777 (new enhancement)

Opened 10 years ago

Last modified 8 years ago

Can't view device files

Reported by: gotar Owned by:
Priority: minor Milestone: Future Releases
Component: mcview Version: 4.7.0-pre4
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description (last modified by angel_il) (diff)

Trying to view some device an error is reported:
Cannot view: not a regular file
In my opinion this should be only a warning and such operation could continue if desired as it worked a long time and a few versions before.

...

now it's forbidden

        if (!S_ISREG (st.st_mode)) {
            mc_close (fd);
            mcview_show_error (view, _(" Cannot view: not a regular file "));
            g_free (view->filename);
            view->filename = NULL;
            goto finish;
        }

and we have one problem - calculate filesize.
fstat return 0 for block devices...
as a workaround, we can use ftell like this

off_t mc_ftell (int fd)
{
    fseek(fd, 0L, SEEK_END);
    return ftell(fd);
}

Change History

comment:1 Changed 10 years ago by andrew_b

  • Type changed from defect to enhancement

comment:2 Changed 10 years ago by angel_il

  • Description modified (diff)

comment:3 Changed 8 years ago by andrew_b

  • Branch state set to no branch
  • Milestone changed from 4.7 to Future Releases
Note: See TracTickets for help on using tickets.