Changes between Initial Version and Version 2 of Ticket #1777


Ignore:
Timestamp:
01/19/10 06:34:42 (14 years ago)
Author:
angel_il
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1777

    • Property Type changed from defect to enhancement
  • Ticket #1777 – Description

    initial v2  
    22Cannot view: not a regular file 
    33In 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. 
     4 
     5... 
     6 
     7now it's forbidden 
     8{{{ 
     9        if (!S_ISREG (st.st_mode)) { 
     10            mc_close (fd); 
     11            mcview_show_error (view, _(" Cannot view: not a regular file ")); 
     12            g_free (view->filename); 
     13            view->filename = NULL; 
     14            goto finish; 
     15        } 
     16}}} 
     17 
     18and we have one problem - calculate filesize. 
     19fstat return 0 for block devices... 
     20as a workaround, we can use '''ftell''' like this 
     21 
     22{{{ 
     23off_t mc_ftell (int fd) 
     24{ 
     25    fseek(fd, 0L, SEEK_END); 
     26    return ftell(fd); 
     27} 
     28}}}