diff --git a/vfs/ChangeLog b/vfs/ChangeLog index eb3170a74..01e6c3141 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,5 +1,9 @@ 2003-10-28 Pavel Roskin + * fish.c (fish_fh_open): Use vfs_mkstemps() for write buffers as + well, since the file can be reopened for reading later. + * ftpfs.c (ftpfs_fh_open): Likewise. + * utilvfs.c (vfs_mkstemps): New function - create temporary file with the name resembling the original, but safe for scripts. * direntry.c (vfs_s_open): Use it. diff --git a/vfs/fish.c b/vfs/fish.c index 21b4f697f..c2e206167 100644 --- a/vfs/fish.c +++ b/vfs/fish.c @@ -823,14 +823,18 @@ static int fish_rmdir (struct vfs_class *me, char *path) POSTFIX(OPT_FLUSH); } -static int fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, int mode) +static int +fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, + int mode) { fh->u.fish.append = 0; /* File will be written only, so no need to retrieve it */ - if (((flags & O_WRONLY) == O_WRONLY) && !(flags & (O_RDONLY|O_RDWR))){ + if (((flags & O_WRONLY) == O_WRONLY) && !(flags & (O_RDONLY | O_RDWR))) { fh->u.fish.append = flags & O_APPEND; - if (!fh->ino->localname){ - int tmp_handle = mc_mkstemps (&fh->ino->localname, me->name, NULL); + if (!fh->ino->localname) { + int tmp_handle = + vfs_mkstemps (&fh->ino->localname, me->name, + fh->ino->ent->name); if (tmp_handle == -1) return -1; close (tmp_handle); @@ -838,10 +842,10 @@ static int fish_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, i return 0; } if (!fh->ino->localname) - if (vfs_s_retrieve_file (me, fh->ino)==-1) + if (vfs_s_retrieve_file (me, fh->ino) == -1) return -1; if (!fh->ino->localname) - vfs_die( "retrieve_file failed to fill in localname" ); + vfs_die ("retrieve_file failed to fill in localname"); return 0; } diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index d83177f40..97df49fa3 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1577,8 +1577,8 @@ ftpfs_fh_open (struct vfs_class *me, struct vfs_s_fh *fh, int flags, */ if (FH_SUPER->u.ftp.ctl_connection_busy) { if (!fh->ino->localname) { - int handle = - mc_mkstemps (&fh->ino->localname, me->name, NULL); + int handle = vfs_mkstemps (&fh->ino->localname, me->name, + fh->ino->ent->name); if (handle == -1) return -1; close (handle);