mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
* 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.
This commit is contained in:
parent
af86cebacd
commit
cd644b527c
@ -1,5 +1,9 @@
|
||||
2003-10-28 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* 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.
|
||||
|
16
vfs/fish.c
16
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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user