fix cross-device links with --follow-symlinks
2007-08-14 Paolo Bonzini <bonzini@gnu.org> * sed/execute.c (open_next_file): Follow symlink here... (closedown): ... not here. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-96
This commit is contained in:
1 parent
235425fdd4
commit
95792f701c
3 files changed
+19
-8
No files matched your search
@@ -1,3 +1,8 @@
|
||||
2007-08-14 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* sed/execute.c (open_next_file): Follow symlink here...
|
||||
(closedown): ... not here.
|
||||
|
||||
2007-06-29 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* sed/mbcs.c: Upgrade to GPLv3.
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
Sed 4.1e
|
||||
|
||||
* fixed --follow-symlinks to avoid attempting the creation of cross-device
|
||||
links.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Sed 4.1d (final release candidate for sed 4.2)
|
||||
|
||||
* fixed bug in 'i\' giving a segmentation violation if given alone.
|
||||
|
||||
+8
-8
@@ -707,16 +707,20 @@ open_next_file(name, input)
|
||||
if (in_place_extension)
|
||||
{
|
||||
int input_fd, output_fd;
|
||||
char *tmpdir = ck_strdup(name), *p;
|
||||
char *tmpdir, *p;
|
||||
struct stat st;
|
||||
|
||||
if (follow_symlinks)
|
||||
input->in_file_name = follow_symlink (name);
|
||||
else
|
||||
input->in_file_name = name;
|
||||
|
||||
/* get the base name */
|
||||
tmpdir = ck_strdup(input->in_file_name);
|
||||
if (p = strrchr(tmpdir, '/'))
|
||||
*(p + 1) = 0;
|
||||
else
|
||||
strcpy(tmpdir, ".");
|
||||
|
||||
input->in_file_name = name;
|
||||
|
||||
if (isatty (fileno (input->fp)))
|
||||
panic(_("couldn't edit %s: is a terminal"), input->in_file_name);
|
||||
@@ -762,11 +766,7 @@ closedown(input)
|
||||
const char *target_name;
|
||||
ck_fclose (output_file.fp);
|
||||
|
||||
if (follow_symlinks)
|
||||
target_name = follow_symlink (input->in_file_name);
|
||||
else
|
||||
target_name = input->in_file_name;
|
||||
|
||||
target_name = input->in_file_name;
|
||||
if (strcmp(in_place_extension, "*") != 0)
|
||||
{
|
||||
char *backup_file_name = get_backup_file_name(target_name);
|
||||
|
||||
Reference in new issue
Block a user