Commit 1adda3c7 authored by Mike Miller's avatar Mike Miller

debian/patches/09_avoid_backupfile_warning.patch: Check for existence of...

debian/patches/09_avoid_backupfile_warning.patch: Check for existence of ~/.cdargs before making a backup copy. (Closes: #713007)
parent 8cd4afd2
......@@ -2,6 +2,8 @@ cdargs (1.35-10) UNRELEASED; urgency=low
* Create symlink to emacs lisp source as required by Debian Emacs
Policy. (Closes: #713003)
* debian/patches/09_avoid_backupfile_warning.patch: Check for existence
of ~/.cdargs before making a backup copy. (Closes: #713007)
* Refresh all patches so they apply cleanly.
* Canonicalize Vcs-* control fields.
* Remove obsolete DM-Upload-Allowed control field.
......
Description: Check for existence of ~/.cdargs before making a backup copy
Forwarded: no
Author: Mike Miller <mtmiller@ieee.org>
Bug-Debian: http://bugs.debian.org/713007
Last-Update: 2013-10-30
--- a/src/cdargs.cc
+++ b/src/cdargs.cc
@@ -728,9 +728,12 @@ void list_to_file(void) {
if(opt_user.size() > 0) {
return;
}
- string backup_file = mylistfile + "~";
- if(rename(mylistfile.c_str(),backup_file.c_str()) == -1) {
- fprintf(stderr,"warning: could not create backupfile\n");
+ struct stat buf;
+ if(stat(mylistfile.c_str(),&buf) == 0) {
+ string backup_file = mylistfile + "~";
+ if(rename(mylistfile.c_str(),backup_file.c_str()) == -1) {
+ fprintf(stderr,"warning: could not create backupfile\n");
+ }
}
ofstream listfile(mylistfile.c_str());
if (!listfile) {
......@@ -6,3 +6,4 @@
06_manpage_paths.patch
07_manpage_fsf_address.patch
08_gcc_format_security.patch
09_avoid_backupfile_warning.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment