kloczek / rpms / mc

Forked from rpms/mc 6 years ago
Clone
39c933c
diff -up mc-4.7.0/vfs/vfs.c.jn mc-4.7.0/vfs/vfs.c
39c933c
--- mc-4.7.0/vfs/vfs.c.jn	2009-10-12 13:57:18.000000000 +0200
39c933c
+++ mc-4.7.0/vfs/vfs.c	2009-10-12 14:34:04.000000000 +0200
39c933c
@@ -675,6 +675,9 @@ int
39c933c
 mc_ctl (int handle, int ctlop, void *arg)
39c933c
 {
39c933c
     struct vfs_class *vfs = vfs_op (handle);
39c933c
+    
39c933c
+    if (vfs == NULL)
39c933c
+        return 0;
39c933c
 
39c933c
     return vfs->ctl ? (*vfs->ctl)(vfs_info (handle), ctlop, arg) : 0;
39c933c
 }
39c933c
@@ -708,6 +711,10 @@ mc_close (int handle)
39c933c
 	return -1;
39c933c
     
39c933c
     vfs = vfs_op (handle);
39c933c
+    
39c933c
+    if (vfs == NULL)
39c933c
+    	return -1;
39c933c
+    
39c933c
     if (handle < 3)
39c933c
 	return close (handle);
39c933c
 
39c933c
@@ -798,6 +805,8 @@ mc_readdir (DIR *dirp)
39c933c
     }
39c933c
     handle = *(int *) dirp;
39c933c
     vfs = vfs_op (handle);
39c933c
+    if (vfs == NULL)
39c933c
+    	return NULL;
39c933c
     dirinfo = vfs_info (handle);
39c933c
     if (vfs->readdir) {
39c933c
         entry = (*vfs->readdir) (dirinfo->info);
39c933c
@@ -820,6 +829,9 @@ mc_closedir (DIR *dirp)
39c933c
     int result;
39c933c
     struct vfs_dirinfo *dirinfo;
39c933c
 
39c933c
+    if (vfs == NULL)
39c933c
+    	return -1;
39c933c
+
39c933c
     dirinfo = vfs_info (handle);
39c933c
     if (dirinfo->converter != str_cnv_from_term) str_close_conv (dirinfo->converter);
39c933c
 
39c933c
@@ -874,6 +886,8 @@ int mc_fstat (int handle, struct stat *b
39c933c
     if (handle == -1)
39c933c
 	return -1;
39c933c
     vfs = vfs_op (handle);
39c933c
+    if (vfs == NULL)
39c933c
+    	return -1;
39c933c
     result = vfs->fstat ? (*vfs->fstat) (vfs_info (handle), buf) : -1;
39c933c
     if (result == -1)
39c933c
 	errno = vfs->name ? ferrno (vfs) : E_NOTSUPP;
39c933c
@@ -967,6 +981,8 @@ off_t mc_lseek (int fd, off_t offset, in
39c933c
 	return -1;
39c933c
 
39c933c
     vfs = vfs_op (fd);
39c933c
+    if (vfs == NULL)
39c933c
+    	return -1;
39c933c
     result = vfs->lseek ? (*vfs->lseek)(vfs_info (fd), offset, whence) : -1;
39c933c
     if (result == -1)
39c933c
         errno = vfs->lseek ? ferrno (vfs) : E_NOTSUPP;