[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
patch: patch for bug: backup suffix not used when backup praefix specifi
From: |
Nils Goroll |
Subject: |
patch: patch for bug: backup suffix not used when backup praefix specified |
Date: |
Tue, 9 Jan 2007 12:53:13 +0100 |
User-agent: |
Mutt/1.4.1i |
Hi again,
I have just spotted this little glitch: In patch 2.5.4, when a praefix
/ basename praefix is specified, an optionally specified suffix is not
used for backup file name creation.
Fix:
diff -ub patch-2.5.4/util.c patch-2.5.4.fixsuffix/util.c
--- patch-2.5.4/util.c Mon Aug 30 08:20:08 1999
+++ patch-2.5.4.fixsuffix/util.c Tue Jan 9 12:44:06 2007
@@ -79,7 +79,7 @@
if (backup)
{
int try_makedirs_errno = 0;
- char *bakname;
+ char *bakname=0;
if (origprae || origbase)
{
@@ -102,11 +102,19 @@
break;
}
}
- else
+
{
- bakname = find_backup_file_name (to, backup_type);
+ /* depending whether prefix handling has taken place, we
+ might have a bakname already */
+ char *bakname_tmp = bakname ? bakname : to;
+
+ bakname = find_backup_file_name (bakname_tmp, backup_type);
if (!bakname)
memory_fatal ();
+
+ /* if we had a bakname before, we need to free that one */
+ if (bakname_tmp!=to)
+ free(bakname_tmp);
}
if (to_errno)