Browse Source

* direntry.c (vfs_s_resolve_symlink): Comment out buggy code.
(vfs_s_retrieve_file): Set fh->handle to -1.
(vfs_s_read): Don't manipulate with FH->handle if it is -1.
(vfs_s_write): Likewise.
(vfs_s_close): Likewise.

Andrew V. Samoilov 23 years ago
parent
commit
7df53e2bd2
2 changed files with 17 additions and 11 deletions
  1. 11 4
      vfs/ChangeLog
  2. 6 7
      vfs/direntry.c

+ 11 - 4
vfs/ChangeLog

@@ -1,3 +1,11 @@
+2002-03-06  Andrew V. Samoilov  <kai@cmail.ru>
+
+	* direntry.c (vfs_s_resolve_symlink): Comment out buggy code.
+	(vfs_s_retrieve_file): Set fh->handle to -1.
+	(vfs_s_read): Don't manipulate with FH->handle if it is -1.
+	(vfs_s_write): Likewise.
+	(vfs_s_close): Likewise.
+
 2002-02-27  Andrew V. Samoilov  <kai@cmail.ru>
 
 	* samba/lib/debug.c: Remove syslog support.
@@ -23,11 +31,10 @@
 
 	* direntry.c (vfs_s_retrieve_file): Use off_t for total
 	and stat_size.
+	(vfs_s_resolve_symlink): Use snprintf instead of sprintf.
 
-	* vfs.c (vfs_s_resolve_symlink): Use snprintf
-	instead of sprintf.
-	(vfs_print_stats): Use off_t for have and need.  Cast
-	have to double to eliminate negative percent(s).
+	* vfs.c (vfs_print_stats): Use off_t for have and need.
+	Cast `have' to double to eliminate negative percent(s).
 	Fix print_vfs_message string formats.
 
 	* vfs.h (vfs_print_stats): Adjust declaration.

+ 6 - 7
vfs/direntry.c

@@ -87,9 +87,7 @@ vfs_s_free_inode (vfs *me, vfs_s_inode *ino)
     /* ==0 can happen if freshly created entry is deleted */
     if (ino->st.st_nlink <= 1){
 	while (ino->subdir){
-	    vfs_s_entry *ent;
-	    ent = ino->subdir;
-	    vfs_s_free_entry (me, ent);
+	    vfs_s_free_entry (me, ino->subdir);
 	}
 
 	CALL (free_inode) (me, ino);
@@ -395,7 +393,7 @@ vfs_s_resolve_symlink (vfs *me, vfs_s_entry *entry, char *path, int follow)
     return (MEDATA->find_entry) (me, entry->dir, linkname, follow - 1, 0);
 }
 
-/* Ook, these were functions around direcory entries / inodes */
+/* Ook, these were functions around directory entries / inodes */
 /* -------------------------------- superblock games -------------------------- */
 
 vfs_s_super *
@@ -828,7 +826,7 @@ vfs_s_read (void *fh, char *buffer, int count)
     if (FH->linear == LS_LINEAR_OPEN)
         return MEDATA->linear_read (me, FH, buffer, count);
         
-    if (FH->handle){
+    if (FH->handle != -1){
 	n = read (FH->handle, buffer, count);
 	if (n < 0)
 	    me->verrno = errno;
@@ -848,7 +846,7 @@ vfs_s_write (void *fh, char *buffer, int count)
 	vfs_die ("no writing to linear files, please");
         
     FH->changed = 1;
-    if (FH->handle){
+    if (FH->handle != -1){
 	n = write (FH->handle, buffer, count);
 	if (n < 0)
 	    me->verrno = errno;
@@ -922,7 +920,7 @@ vfs_s_close (void *fh)
 	}
 	vfs_s_invalidate (me, FH_SUPER);
     }
-    if (FH->handle)
+    if (FH->handle != -1)
 	close (FH->handle);
 	
     vfs_s_free_inode (me, FH->ino);
@@ -943,6 +941,7 @@ vfs_s_retrieve_file(vfs *me, struct vfs_s_inode *ino)
     memset(&fh, 0, sizeof(fh));
 
     fh.ino = ino;
+    fh.handle = -1;
 
     handle = mc_mkstemps (&ino->localname, me->name, NULL);
     if (handle == -1) {