diff -up mc-4.7.0/vfs/vfs.c.jn mc-4.7.0/vfs/vfs.c
old
|
new
|
int |
675 | 675 | mc_ctl (int handle, int ctlop, void *arg) |
676 | 676 | { |
677 | 677 | struct vfs_class *vfs = vfs_op (handle); |
| 678 | |
| 679 | if (vfs == NULL) |
| 680 | return 0; |
678 | 681 | |
679 | 682 | return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0; |
680 | 683 | } |
… |
… |
mc_close (int handle) |
708 | 711 | return -1; |
709 | 712 | |
710 | 713 | vfs = vfs_op (handle); |
| 714 | |
| 715 | if (vfs == NULL) |
| 716 | return -1; |
| 717 | |
711 | 718 | if (handle < 3) |
712 | 719 | return close (handle); |
713 | 720 | |
… |
… |
mc_readdir (DIR *dirp) |
798 | 805 | } |
799 | 806 | handle = *(int *) dirp; |
800 | 807 | vfs = vfs_op (handle); |
| 808 | if (vfs == NULL) |
| 809 | return NULL; |
801 | 810 | dirinfo = vfs_info (handle); |
802 | 811 | if (vfs->readdir) { |
803 | 812 | entry = (*vfs->readdir) (dirinfo->info); |
… |
… |
mc_closedir (DIR *dirp) |
820 | 829 | int result; |
821 | 830 | struct vfs_dirinfo *dirinfo; |
822 | 831 | |
| 832 | if (vfs == NULL) |
| 833 | return -1; |
| 834 | |
823 | 835 | dirinfo = vfs_info (handle); |
824 | 836 | if (dirinfo->converter != str_cnv_from_term) str_close_conv (dirinfo->converter); |
825 | 837 | |
… |
… |
int mc_fstat (int handle, struct stat *b |
874 | 886 | if (handle == -1) |
875 | 887 | return -1; |
876 | 888 | vfs = vfs_op (handle); |
| 889 | if (vfs == NULL) |
| 890 | return -1; |
877 | 891 | result = vfs->fstat ? (*vfs->fstat) (vfs_info (handle), buf) : -1; |
878 | 892 | if (result == -1) |
879 | 893 | errno = vfs->name ? ferrno (vfs) : E_NOTSUPP; |
… |
… |
off_t mc_lseek (int fd, off_t offset, in |
967 | 981 | return -1; |
968 | 982 | |
969 | 983 | vfs = vfs_op (fd); |
| 984 | if (vfs == NULL) |
| 985 | return -1; |
970 | 986 | result = vfs->lseek ? (*vfs->lseek)(vfs_info (fd), offset, whence) : -1; |
971 | 987 | if (result == -1) |
972 | 988 | errno = vfs->lseek ? ferrno (vfs) : E_NOTSUPP; |