[sed/f17] Fixed the readded -c option (left temporary files behind)

Martin Briza mbriza at fedoraproject.org
Tue Jul 10 14:24:25 UTC 2012


commit 18c2ba306fd29817b29f75ae603d225bdc492909
Author: Martin Briza <mbriza at redhat.com>
Date:   Tue Jul 10 16:17:13 2012 +0200

    Fixed the readded -c option (left temporary files behind)

 sed-4.2.1-copy.patch |   19 +++++++++++++++----
 sed.spec             |    4 ++++
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/sed-4.2.1-copy.patch b/sed-4.2.1-copy.patch
index 48bde87..673e8d8 100644
--- a/sed-4.2.1-copy.patch
+++ b/sed-4.2.1-copy.patch
@@ -29,7 +29,7 @@ index af8c4d2..c05b418 100644
          {
            char *backup_file_name = get_backup_file_name(target_name);
 -	  ck_rename (target_name, backup_file_name, input->out_file_name);
-+	  (copy_instead_of_rename?ck_fcmove:ck_rename)
++	  (copy_instead_of_rename?ck_fccopy:ck_rename)
 +            (target_name, backup_file_name, input->out_file_name);
            free (backup_file_name);
  	}
@@ -135,7 +135,7 @@ index 241ef1d..ebe6030 100644
  
  #include "utils.h"
  #include "pathmax.h"
-@@ -408,33 +409,99 @@ follow_symlink(const char *fname)
+@@ -408,33 +409,109 @@ follow_symlink(const char *fname)
    return fname;
  #endif /* ENABLE_FOLLOW_SYMLINKS */
  }
@@ -238,13 +238,23 @@ index 241ef1d..ebe6030 100644
  
 +/* Attempt to copy file contents between the files. */
 +void
-+ck_fcmove (from, to, unlink_if_fail)
++ck_fccopy (from, to, unlink_if_fail)
 +  const char *from, *to;
 +  const char *unlink_if_fail;
 +{
 +  if (!_unlink_if_fail (_copy (from, to), unlink_if_fail))
 +    panic (_("cannot copy %s to %s: %s"), from, to, strerror (errno));
 +}
++
++/* Copy contents between files, and then unlink the source. */
++void
++ck_fcmove (from, to, unlink_if_fail)
++  const char *from, *to;
++  const char *unlink_if_fail;
++{
++  ck_fccopy (from, to, unlink_if_fail);
++  ck_unlink (from);
++}
  
  
  
@@ -252,10 +262,11 @@ diff --git a/sed/utils.h b/sed/utils.h
 index d3f431d..b915596 100644
 --- a/sed/utils.h
 +++ b/sed/utils.h
-@@ -32,6 +32,7 @@ const char *follow_symlink P_((const char *path));
+@@ -32,6 +32,8 @@ const char *follow_symlink P_((const char *path));
  size_t ck_getline P_((char **text, size_t *buflen, FILE *stream));
  FILE * ck_mkstemp P_((char **p_filename, char *tmpdir, char *base));
  void ck_rename P_((const char *from, const char *to, const char *unlink_if_fail));
++void ck_fccopy P_((const char *from, const char *to, const char *unlink_if_fail));
 +void ck_fcmove P_((const char *from, const char *to, const char *unlink_if_fail));
  
  VOID *ck_malloc P_((size_t size));
diff --git a/sed.spec b/sed.spec
index 3e8d466..e15ef69 100644
--- a/sed.spec
+++ b/sed.spec
@@ -74,6 +74,10 @@ rm -rf ${RPM_BUILD_ROOT}
 %{_mandir}/man*/*
 
 %changelog
+* Tue Jul 10 2012 Martin Briza <mbriza at redhat.com> - 4.2.1-10
+- Fixed the readded -c option rhbz#832855
+  Resolves: #832855
+
 * Wed Jun 13 2012 Martin Briza <mbriza at redhat.com> - 4.2.1-9
 - Backported commit from upstream to fix treating "x26" as "&" character
   Resolves: #812067


More information about the scm-commits mailing list